teststore

package
v1.24.6-rc-multipart Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Items      []storage.ListItem
	ForceError int

	CallCount struct {
		Get            int
		Put            int
		List           int
		GetAll         int
		Delete         int
		Close          int
		Iterate        int
		CompareAndSwap int
	}
	// contains filtered or unexported fields
}

Client implements in-memory key value store.

func New

func New() *Client

New creates a new in-memory key-value store.

func (*Client) Close

func (store *Client) Close() error

Close closes the store.

func (*Client) CompareAndSwap added in v0.16.0

func (store *Client) CompareAndSwap(ctx context.Context, key storage.Key, oldValue, newValue storage.Value) (err error)

CompareAndSwap atomically compares and swaps oldValue with newValue.

func (*Client) Delete

func (store *Client) Delete(ctx context.Context, key storage.Key) (err error)

Delete deletes key and the value.

func (*Client) DeleteMultiple added in v0.33.2

func (store *Client) DeleteMultiple(ctx context.Context, keys []storage.Key) (_ storage.Items, err error)

DeleteMultiple deletes keys ignoring missing keys.

func (*Client) Get

func (store *Client) Get(ctx context.Context, key storage.Key) (_ storage.Value, err error)

Get gets a value to store.

func (*Client) GetAll

func (store *Client) GetAll(ctx context.Context, keys storage.Keys) (_ storage.Values, err error)

GetAll gets all values from the store.

func (*Client) Iterate

func (store *Client) Iterate(ctx context.Context, opts storage.IterateOptions, fn func(context.Context, storage.Iterator) error) (err error)

Iterate iterates over items based on opts.

func (*Client) IterateWithoutLookupLimit added in v1.4.1

func (store *Client) IterateWithoutLookupLimit(ctx context.Context, opts storage.IterateOptions, fn func(context.Context, storage.Iterator) error) (err error)

IterateWithoutLookupLimit calls the callback with an iterator over the keys, but doesn't enforce default limit on opts.

func (*Client) List

func (store *Client) List(ctx context.Context, first storage.Key, limit int) (_ storage.Keys, err error)

List lists all keys starting from start and upto limit items.

func (*Client) LookupLimit added in v0.31.0

func (store *Client) LookupLimit() int

LookupLimit returns the maximum limit that is allowed.

func (*Client) MigrateToLatest added in v1.4.1

func (store *Client) MigrateToLatest(ctx context.Context) error

MigrateToLatest pretends to migrate to latest db schema version.

func (*Client) Put

func (store *Client) Put(ctx context.Context, key storage.Key, value storage.Value) (err error)

Put adds a value to store.

func (*Client) SetLookupLimit added in v0.31.0

func (store *Client) SetLookupLimit(v int)

SetLookupLimit sets the lookup limit.

Jump to

Keyboard shortcuts

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