Documentation
¶
Index ¶
- Constants
- func NewStores(cfg *config.DatastoreList, gmetrics *gmetric.Service) (map[string]*Service, error)deprecated
- func NewStoresV2(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool) (map[string]*Service, error)
- func NewStoresV3(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool, ...) (map[string]*Service, error)
- func NewStoresV4(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool, ...) (map[string]*Service, error)
- type CacheStatus
- type Entry
- type EntryData
- type Key
- type Service
- func (s *Service) Config() *config.Datastore
- func (s *Service) Enabled() bool
- func (s *Service) GetInto(ctx context.Context, key *Key, storable Value) (dictHash int, err error)
- func (s *Service) Key(key string) *Key
- func (s *Service) Mode() StoreMode
- func (s *Service) Put(ctx context.Context, key *Key, value Value, dictHash int) error
- func (s *Service) SetMode(mode StoreMode)
- type StoreMode
- type Storer
- type Value
Constants ¶
const ( // CacheStatusFoundNoSuchKey we cache the status that we did not find a cache; this no-cache value has a shorter expiry CacheStatusFoundNoSuchKey = CacheStatus(iota) // CacheStatusNotFound no such key status CacheStatusNotFound // CacheStatusFound entry found status CacheStatusFound )
const ( ModeServer = StoreMode(0) ModeClient = StoreMode(1) )
Variables ¶
This section is empty.
Functions ¶
func NewStoresV2 ¶ added in v0.6.0
func NewStoresV2(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool) (map[string]*Service, error)
NewStoresV2 verbose enables logging of connections on creation. Deprecated: use NewStoresV4.
func NewStoresV3 ¶ added in v0.15.0
func NewStoresV3(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool, connections map[string]*client.Service) (map[string]*Service, error)
NewStoresV3 creates new stores, see NewStoresV2 for more information. connections is a map of connections to be used for datastores. Note that connections shares via ID, not by Hostnames. Deprecated: use NewStoresV4.
func NewStoresV4 ¶ added in v0.16.0
func NewStoresV4(cfg *config.DatastoreList, gmetrics *gmetric.Service, verbose bool, connections map[string]*client.Service, clientOptions []client.Option) (map[string]*Service, error)
NewStoresV4 creates new stores, see NewStoresV3 for more information. Adds support for []client.Option.
Types ¶
type CacheStatus ¶
type CacheStatus int
type Entry ¶
Entry represents data entry
func (*Entry) DecodeBinary ¶
DecodeBinary decodes data to binary stream
type Key ¶
type Key struct { Namespace string Set string Value interface{} *aero.GenerationPolicy TimeToLive time.Duration L2 *Key }
Key represents a datastore key
func (*Key) WritePolicy ¶
func (k *Key) WritePolicy(generation uint32) *aero.WritePolicy
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service datastore service
func NewWithCache ¶
func NewWithCache(config *config.Datastore, l1Client, l2Client *client.Service, counter *gmetric.Operation, writeCounter *gmetric.Operation) (*Service, error)
NewWithCache creates a cache optionally
type StoreMode ¶
type StoreMode int
StoreMode represents service mode. TODO: change implementation and split the code appropriately for handling server and client side.
type Storer ¶
type Storer interface { // Put writes the value to a set of backplanes. // dictHash is provided to invalidate caches in case the same input should result in a different value; kind of like an etag/version. Put(ctx context.Context, key *Key, value Value, dictHash int) error // GetInto will attempt to pull a value from backplanes. // If a further cache has a value but a closer one does not, this should populate the closer cache. // Should return the dictHash (etag/version). GetInto(ctx context.Context, key *Key, storable Value) (dictHash int, err error) // TODO refactor out implementation Aerospike specific values. Key(key string) *Key // TODO remove / rethink implementation. Mode() StoreMode SetMode(mode StoreMode) Enabled() bool Config() *config.Datastore }