memory

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package memory implements a fully in-memory key/value store for the database to use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKV

func NewKV(l hclog.Logger) (db.KVStore, error)

NewKV is exported to allow other test stores to be built on top of this one, such as the errorableKV used in the rpc2 integration test.

Types

type KV

type KV struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

KV is a fully in-memory KV store. It is intended to be used with integration tests, not in production. It is not included in release builds by default.

func (*KV) Capabilities

func (kv *KV) Capabilities() []db.KVCapability

Capabilities is used to interrogate a KV store for capabilities.

func (*KV) Close

func (kv *KV) Close() error

Close is used in other implementations to finalize access.

func (*KV) Del

func (kv *KV) Del(_ context.Context, k string) error

Del removes a value for a given key

func (*KV) Get

func (kv *KV) Get(_ context.Context, k string) ([]byte, error)

Get retrives a value

func (*KV) Keys

func (kv *KV) Keys(_ context.Context, filter string) ([]string, error)

Keys returns a set of keys optionally filtered by the filter expression. filter should be a regex/shell type glob.

func (*KV) Put

func (kv *KV) Put(_ context.Context, k string, v []byte) error

Put stores a value

func (*KV) SetEventFunc

func (kv *KV) SetEventFunc(ef func(db.Event))

SetEventFunc supplies the event firing entrypoing for this implementation.

Jump to

Keyboard shortcuts

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