mockstore

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 4 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
	ErrCreateIndex          error
	ErrQuery                error
	ResultsIteratorToReturn storage.ResultsIterator
	// contains filtered or unexported fields
}

MockStore represents a mock store.

func (*MockStore) CreateIndex added in v0.1.3

func (s *MockStore) CreateIndex(createIndexRequest storage.CreateIndexRequest) error

CreateIndex returns a mocked error.

func (*MockStore) Get

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

Get fetches the value associated with the given key

func (*MockStore) Put

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

Put stores the key-value pair

func (*MockStore) Query added in v0.1.3

func (s *MockStore) Query(query string) (storage.ResultsIterator, error)

Query returns a mocked error.

type Provider

type Provider struct {
	Store              *MockStore
	ErrCreateStore     error
	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) CloseStore

func (p *Provider) CloseStore(name string) error

CloseStore closes store for given name space

func (*Provider) CreateStore added in v0.1.2

func (p *Provider) CreateStore(name string) error

CreateStore creates a new store with the given name.

func (*Provider) OpenStore

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

OpenStore opens and returns a store for given name space.

Jump to

Keyboard shortcuts

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