storage

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBEntry

type DBEntry struct {
	Value []byte
	Tags  []storage.Tag
}

DBEntry is a value plus optional tags that are associated with some key.

type MockStore

type MockStore struct {
	Store map[string]DBEntry

	ErrPut    error
	ErrGet    error
	ErrDelete error
	ErrQuery  error
	ErrNext   error
	ErrValue  error
	ErrKey    error
	ErrBatch  error
	ErrClose  error
	// contains filtered or unexported fields
}

MockStore mock store.

func (*MockStore) Batch

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

Batch stores a batch of operations.

func (*MockStore) Close

func (s *MockStore) Close() error

Close is not implemented.

func (*MockStore) Delete

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

Delete will delete record with k key.

func (*MockStore) Flush

func (s *MockStore) Flush() error

Flush is not implemented.

func (*MockStore) Get

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

Get fetches the record based on key.

func (*MockStore) GetBulk

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

GetBulk is not implemented.

func (*MockStore) GetTags

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

GetTags is not implemented.

func (*MockStore) Put

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

Put stores the key and the record.

func (*MockStore) Query

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

Query returns all data that satisfies the expression. Expression format: TagName:TagValue. If TagValue is not provided, then all data associated with the TagName will be returned. For now, expression can only be a single tag Name + Value pair.

type MockStoreProvider

type MockStoreProvider struct {
	Store              *MockStore
	Custom             storage.Store
	ErrOpenStoreHandle error
	ErrSetStoreConfig  error
	ErrClose           error
	ErrCloseStore      error
	FailNamespace      string
}

MockStoreProvider mock store provider.

func NewCustomMockStoreProvider

func NewCustomMockStoreProvider(customStore storage.Store) *MockStoreProvider

NewCustomMockStoreProvider new mock store provider instance from existing mock store.

func NewMockStoreProvider

func NewMockStoreProvider() *MockStoreProvider

NewMockStoreProvider new store provider instance.

func (*MockStoreProvider) Close

func (s *MockStoreProvider) Close() error

Close closes all stores created under this store provider.

func (*MockStoreProvider) CloseStore

func (s *MockStoreProvider) CloseStore(name string) error

CloseStore closes store for given name space.

func (*MockStoreProvider) GetOpenStores

func (s *MockStoreProvider) GetOpenStores() []storage.Store

GetOpenStores is not implemented.

func (*MockStoreProvider) GetStoreConfig

func (s *MockStoreProvider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig is not implemented.

func (*MockStoreProvider) OpenStore

func (s *MockStoreProvider) OpenStore(name string) (storage.Store, error)

OpenStore opens and returns a store for given name space.

func (*MockStoreProvider) SetStoreConfig

func (s *MockStoreProvider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig always return a nil error.

Jump to

Keyboard shortcuts

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