datastore

package
v0.0.0-...-85902bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//CacheStatusFoundNoSuchKey cacheable no such key status
	CacheStatusFoundNoSuchKey = CacheStatus(iota)
	//CacheStatusNotFound no such key status
	CacheStatusNotFound
	//CacheStatusFound entry found status
	CacheStatusFound
)

Variables

This section is empty.

Functions

func NewStores

func NewStores(cfg *config.DatastoreList, gmetrics *gmetric.Service) (map[string]*Service, error)

NewStores creates new stores

Types

type CacheStatus

type CacheStatus int

type Entry

type Entry struct {
	Key      string
	Data     EntryData
	Hash     int
	NotFound bool
	Expiry   time.Time
}

Entry represents data entry

func (*Entry) DecodeBinary

func (e *Entry) DecodeBinary(stream *bintly.Reader) error

DecodeBinary decodes data to binary stream

func (*Entry) EncodeBinary

func (e *Entry) EncodeBinary(stream *bintly.Writer) error

EncodeBinary encodes data from binary stream

type EntryData

type EntryData interface{}

EntryData

type Key

type Key struct {
	Namespace string
	Set       string
	Value     interface{}
	*aero.GenerationPolicy
	TimeToLive time.Duration
	L2         *Key
}

Key represents a datastore key

func NewKey

func NewKey(cfg *config.Datastore, key string) *Key

func (*Key) AsString

func (k *Key) AsString() string

func (*Key) Key

func (k *Key) Key() (*aero.Key, error)

func (*Key) WritePolicy

func (k *Key) WritePolicy(generation uint32) *aero.WritePolicy

type Service

type Service struct {
	Config     *config.Datastore
	ClientMode bool
	// contains filtered or unexported fields
}

Service datastore service

func New

func New(l1Client, l2Client client.Service, counter *gmetric.Operation) *Service

New returns a new Service

func NewWithCache

func NewWithCache(config *config.Datastore, l1Client, l2Client client.Service, counter *gmetric.Operation) (*Service, error)

NewWithCache creates Service with cache

func (*Service) GetInto

func (s *Service) GetInto(ctx context.Context, key *Key, storable Value) (dictHash int, err error)

GetInto gets data into storable or error

func (*Service) Put

func (s *Service) Put(ctx context.Context, key *Key, value Value, dictHash int) error

Put puts entry to the datastore

type Value

type Value interface{}

Value represents a datastore value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL