Documentation ¶
Index ¶
- Constants
- Variables
- func Request(url, method string, payload []byte) ([]byte, error)
- type BadgerDB
- func (bdb *BadgerDB) Close() error
- func (bdb *BadgerDB) Get(namespace, key []byte) (value []byte, err error)
- func (bdb *BadgerDB) Has(namespace, key []byte) (ok bool, err error)
- func (bdb *BadgerDB) Set(namespace, key, value []byte) error
- func (bdb *BadgerDB) SetWithTTL(namespace, key, value []byte, ttl time.Duration) error
- type ClientManager
- type DB
- type Logger
Constants ¶
const (
// RequestGET defines a GET HTTP request method.
RequestGET = "GET"
)
Variables ¶
var ( BadgerAlertsNamespace = []byte("alerts") BadgerMonitorsNamespace = []byte("monitors") )
Badger namespaces
Functions ¶
Types ¶
type BadgerDB ¶
type BadgerDB struct {
// contains filtered or unexported fields
}
BadgerDB is a wrapper around a BadgerDB backend database that implements the DB interface.
func (*BadgerDB) Close ¶
Close implements the DB interface. It closes the connection to the underlying BadgerDB database as well as invoking the context's cancel function.
func (*BadgerDB) Get ¶
Get implements the DB interface. It attempts to get a value for a given key and namespace. If the key does not exist in the provided namespace, an error is returned, otherwise the retrieved value.
func (*BadgerDB) Has ¶
Has implements the DB interface. It returns a boolean reflecting if the database has a given key for a namespace or not. An error is only returned if an error to Get would be returned that is not of type badger.ErrKeyNotFound.
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
ClientManager implements a simple round-robin load balancing client manager.
func NewClientManager ¶
func NewClientManager(clients []string) *ClientManager
NewClientManager returns a reference to a new initialized ClientManager with a given list of clients.
func (*ClientManager) Next ¶
func (cm *ClientManager) Next() string
Next returns the next client to be used from the client manager. Each client is round-robin load balanced.
type DB ¶
type DB interface { Get(namespace, key []byte) (value []byte, err error) Set(namespace, key, value []byte) error Has(namespace, key []byte) (bool, error) SetWithTTL(namespace, key, value []byte, ttl time.Duration) error Close() error }
DB defines an embedded key/value store database interface.
type Logger ¶
type Logger struct {
log.FieldLogger
}
Logger is a simple wrapper around a Logrus logger.
func CreateBaseLogger ¶
CreateBaseLogger creates a base logger for which other components and modules can extend upon, inheriting the base configuration and settings of a core logger. An error is returned if a non-empty log file path is given that cannot be created.