memstore

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 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 MemStore

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

MemStore is a simple DB that's stored in memory. Useful for demos or testing. Not designed to be performant.

func (*MemStore) CreateIndex added in v0.1.3

func (m *MemStore) CreateIndex(createIndexRequest storage.CreateIndexRequest) error

CreateIndex is not supported in memstore, and calling it will always return an error.

func (*MemStore) Delete added in v0.1.4

func (m *MemStore) Delete(k string) error

Delete deletes the key-value pair associated with k.

func (*MemStore) Get

func (m *MemStore) Get(k string) ([]byte, error)

Get retrieves the value in the store associated with the given key.

func (*MemStore) GetAll added in v0.1.4

func (m *MemStore) GetAll() (map[string][]byte, error)

GetAll fetches all the key-value pairs within this store.

func (*MemStore) GetBulk added in v0.1.5

func (m *MemStore) GetBulk(keys ...string) ([][]byte, error)

GetBulk fetches the values associated with the given keys. This method works in an all-or-nothing manner. It returns an error if any of the keys don't exist. If even one key is missing, then no values are returned.

func (*MemStore) Put

func (m *MemStore) Put(k string, v []byte) error

Put stores the given key-value pair in the store.

func (*MemStore) PutBulk added in v0.1.5

func (m *MemStore) PutBulk(keys []string, values [][]byte) error

PutBulk stores the key-value pairs in the order given in the array. The end result is equivalent to calling Put(k,v) on each key-value pair individually in a loop.

func (*MemStore) Query added in v0.1.3

func (m *MemStore) Query(query string) (storage.ResultsIterator, error)

Query is not supported in memstore, and calling it will always return an error.

type Provider

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

Provider represents an MemStore implementation of the storage.Provider interface.

func NewProvider

func NewProvider() *Provider

NewProvider instantiates Provider.

func (*Provider) Close

func (p *Provider) Close() error

Close closes the provider.

func (*Provider) CloseStore

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

CloseStore closes a previously opened store.

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 an existing store with the given name and returns it.

Jump to

Keyboard shortcuts

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