<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package simplepush

import (
	"fmt"
	"time"
)

var (
	ErrInvalidID    StorageError = "Invalid UUID"
	AvailableStores              = make(AvailableExtensions)
)

// StorageError represents an adapter storage error.
type StorageError string

// Error implements the `error` interface.
func (err StorageError) Error() string {
	return fmt.Sprintf("StorageError: %s", err)
}

// Update represents a notification sent on a channel.
type Update struct {
	ChannelID string `json:"channelID"`
	Version   uint64 `json:"version"`
}

// DbConf specifies generic database adapter options.
type DbConf struct {
	// TimeoutLive is the active channel record timeout. Defaults to 3 days.
	TimeoutLive int64 `toml:"timeout_live"`

	// TimeoutReg is the registered channel record timeout. Defaults to 3 hours;
	// an app server should send a notification on a registered channel before
	// this timeout.
	TimeoutReg int64 `toml:"timeout_reg"`

	// TimeoutDel is the deleted channel record timeout. Defaults to 1 day;
	// deleted records will be pruned after this timeout.
	TimeoutDel int64 `toml:"timeout_del"`

	// HandleTimeout is the maximum time to wait when acquiring a connection from
	// the pool. Defaults to 5 seconds.
	HandleTimeout string `toml:"handle_timeout"`

	// HostPrefix is the key prefix for client hosts. Defaults to `"_h-"`.
	HostPrefix string `toml:"shard_prefix"`

	// PingPrefix is the key prefix for proprietary (GCM, etc.) pings. Defaults to<commit_msg>`StorageError.Error()`: Avoid infinite recursion.<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package simplepush

import (
	"fmt"
	"time"
)

var (
	ErrInvalidID    StorageError = "Invalid UUID"
	AvailableStores              = make(AvailableExtensions)
)

// StorageError represents an adapter storage error.
type StorageError string

// Error implements the `error` interface.
func (err StorageError) Error() string {
	return fmt.Sprintf("StorageError: %s", string(err))
}

// Update represents a notification sent on a channel.
type Update struct {
	ChannelID string `json:"channelID"`
	Version   uint64 `json:"version"`
}

// DbConf specifies generic database adapter options.
type DbConf struct {
	// TimeoutLive is the active channel record timeout. Defaults to 3 days.
	TimeoutLive int64 `toml:"timeout_live"`

	// TimeoutReg is the registered channel record timeout. Defaults to 3 hours;
	// an app server should send a notification on a registered channel before
	// this timeout.
	TimeoutReg int64 `toml:"timeout_reg"`

	// TimeoutDel is the deleted channel record timeout. Defaults to 1 day;
	// deleted records will be pruned after this timeout.
	TimeoutDel int64 `toml:"timeout_del"`

	// HandleTimeout is the maximum time to wait when acquiring a connection from
	// the pool. Defaults to 5 seconds.
	HandleTimeout string `toml:"handle_timeout"`

	// HostPrefix is the key prefix for client hosts. Defaults to `"_h-"`.
	HostPrefix string `toml:"shard_prefix"`

	// PingPrefix is the key prefix for proprietary (GCM, etc.) pings. Defaults to
{'fraction_non_alphanumeric': 0.087683284457478, 'fraction_numerical': 0.0093841642228739, 'mean_word_length': 3.8728571428571428, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3383479', 'n_tokens_mistral': 996, 'n_tokens_neox': 940, 'n_words': 416}