teststore

package
v1.105.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 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      []kvstore.Item
	ForceError int

	CallCount struct {
		Get            int
		Put            int
		Delete         int
		Close          int
		Range          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 v1.96.4

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

CompareAndSwap atomically compares and swaps oldValue with newValue.

func (*Client) Delete

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

Delete deletes key and the value.

func (*Client) Get

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

Get gets a value to store.

func (*Client) MigrateToLatest

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 kvstore.Key, value kvstore.Value) (err error)

Put adds a value to store.

func (*Client) Range

func (store *Client) Range(ctx context.Context, fn func(context.Context, kvstore.Key, kvstore.Value) error) error

Range iterates over all items in unspecified order.

Jump to

Keyboard shortcuts

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