store

package
v2.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEndpoints

func MakeEndpoints(host string, registry Registry, logger log.Logger)

Types

type Builder

type Builder func(name string, keyEncoder encoding.Builder, valEncoder encoding.Builder, options ...Options) (Store, error)

type Err

type Err struct {
	Err string `json:"error"`
}

type Iterator

type Iterator interface {
	SeekToFirst()
	SeekToLast()
	Seek(key interface{}) error
	Next()
	Prev()
	Close()
	Key() (interface{}, error)
	Value() (interface{}, error)
	Valid() bool
	Error() error
}

type Meta

type Meta struct {
	// contains filtered or unexported fields
}

func NewMata

func NewMata(c sarama.Client, group string) *Meta

func (*Meta) GetMeta

func (m *Meta) GetMeta(tp string) string

func (*Meta) Refresh

func (m *Meta) Refresh()

type MockStore

type MockStore struct {
	// contains filtered or unexported fields
}

func (*MockStore) Backend

func (s *MockStore) Backend() backend.Backend

func (*MockStore) Delete

func (s *MockStore) Delete(ctx context.Context, key interface{}) error

func (*MockStore) Get

func (s *MockStore) Get(ctx context.Context, key interface{}) (value interface{}, err error)

func (*MockStore) GetAll

func (*MockStore) GetAll(ctx context.Context) (Iterator, error)

func (*MockStore) GetRange

func (*MockStore) GetRange(ctx context.Context, fromKey interface{}, toKey interface{}) (map[interface{}]interface{}, error)

func (*MockStore) KeyEncoder

func (s *MockStore) KeyEncoder() encoding.Encoder

func (*MockStore) Name

func (s *MockStore) Name() string

func (*MockStore) Set

func (s *MockStore) Set(ctx context.Context, key interface{}, value interface{}, expiry time.Duration) error

func (*MockStore) String

func (s *MockStore) String() string

func (*MockStore) ValEncoder

func (s *MockStore) ValEncoder() encoding.Encoder

type Options

type Options func(config *storeOptions)

func Buffered

func Buffered(size int) Options

func ChangelogEnabled

func ChangelogEnabled() Options

func Compacated

func Compacated() Options

func Expire

func Expire(d time.Duration) Options

func WithBackend

func WithBackend(backend backend.Backend) Options

func WithBackendBuilder

func WithBackendBuilder(builder backend.Builder) Options

func WithChangelog

func WithChangelog(changelog changelog.Changelog) Options

type RecoverableStore

type RecoverableStore interface {
	Store
	Recover(ctx context.Context) error
}

type Registry

type Registry interface {
	Register(store Store)
	New(name string, keyEncoder encoding.Builder, valEncoder encoding.Builder, options ...Options) Store
	Store(name string) Store
	List() []string
}

func NewRegistry

func NewRegistry(config *RegistryConfig) Registry

type RegistryConfig

type RegistryConfig struct {
	Host string

	StoreBuilder      Builder
	StateStoreBuilder StateStoreBuilder
	Logger            log.Logger
	MetricsReporter   metrics.Reporter
	// contains filtered or unexported fields
}

type StateStore

type StateStore interface {
	Name() string
	Set(key interface{}, value interface{}) error
	Get(key interface{}) (value interface{}, err error)
	GetAll() ([]*data.Record, error)
}

func NewStateStore

func NewStateStore(name string, keyEncoder encoding.Encoder, valEncoder encoding.Encoder, options ...Options) StateStore

type StateStoreBuilder

type StateStoreBuilder func(name string, keyEncoder encoding.Builder, valEncoder encoding.Builder, options ...Options) StateStore

type Store

type Store interface {
	Name() string
	Backend() backend.Backend
	KeyEncoder() encoding.Encoder
	ValEncoder() encoding.Encoder
	Set(ctx context.Context, key interface{}, value interface{}, expiry time.Duration) error
	Get(ctx context.Context, key interface{}) (value interface{}, err error)
	GetRange(ctx context.Context, fromKey interface{}, toKey interface{}) (map[interface{}]interface{}, error)
	GetAll(ctx context.Context) (Iterator, error)
	Delete(ctx context.Context, key interface{}) error
	String() string
}

func NewMockStore

func NewMockStore(name string, kEncode encoding.Encoder, vEncoder encoding.Encoder, backend backend.Backend) Store

func NewStore

func NewStore(name string, keyEncoder encoding.Encoder, valEncoder encoding.Encoder, logger log.Logger, options ...Options) (Store, error)

Jump to

Keyboard shortcuts

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