mockstorage

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStore

type MockStore struct {
	Store map[string][]byte

	ErrPut error
	ErrGet error
	// contains filtered or unexported fields
}

MockStore represents a mock store.

func (*MockStore) Batch added in v0.1.6

func (s *MockStore) Batch(operations []storage.Operation) error

Batch performs multiple Put and/or Delete operations in order.

func (*MockStore) Close added in v0.1.6

func (s *MockStore) Close() error

Close closes this store object, freeing resources.

func (*MockStore) Delete

func (s *MockStore) Delete(k string) error

Delete is currently unimplemented.

func (*MockStore) Flush added in v0.1.6

func (s *MockStore) Flush() error

Flush forces any queued up Put and/or Delete operations to execute.

func (*MockStore) Get

func (s *MockStore) Get(k string) ([]byte, error)

Get fetches the value associated with the given key.

func (*MockStore) GetBulk added in v0.1.6

func (s *MockStore) GetBulk(k ...string) ([][]byte, error)

GetBulk mock is not implemented.

func (*MockStore) GetTags added in v0.1.6

func (s *MockStore) GetTags(key string) ([]storage.Tag, error)

GetTags fetches all tags associated with the given key.

func (*MockStore) Put

func (s *MockStore) Put(k string, v []byte, _ ...storage.Tag) error

Put stores the key-value pair.

func (*MockStore) PutBulk added in v0.1.6

func (s *MockStore) PutBulk(keys []string, values [][]byte) error

PutBulk mock not implemented.

func (*MockStore) Query

func (s *MockStore) Query(expression string, options ...storage.QueryOption) (storage.Iterator, error)

Query returns all data that satisfies the expression. Expression format: TagName:TagValue.

type Provider

type Provider struct {
	Stores             map[string]storage.Store
	Store              *MockStore
	ErrOpenStoreHandle error
	FailNameSpace      string
}

Provider mock store provider.

func NewMockStoreProvider

func NewMockStoreProvider() *Provider

NewMockStoreProvider new store provider instance.

func (*Provider) Close

func (p *Provider) Close() error

Close closes all stores created under this store provider.

func (*Provider) GetOpenStores added in v0.1.6

func (p *Provider) GetOpenStores() []storage.Store

GetOpenStores returns all currently open stores.

func (*Provider) GetStoreConfig added in v0.1.6

func (p *Provider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig gets the current store configuration.

func (*Provider) OpenStore

func (p *Provider) OpenStore(name string) (storage.Store, error)

OpenStore opens and returns a store for given name space.

func (*Provider) SetStoreConfig added in v0.1.6

func (p *Provider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig sets the configuration on a store.

Jump to

Keyboard shortcuts

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