kv

package
Version: v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package kv provides interface for interacting with a key-value store.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyKey is returned when the key is empty.
	ErrEmptyKey = errors.New("empty key")

	// ErrNotFound is returned when the key does not exist on the key-value store.
	ErrNotFound = errors.New("not found")
)

Functions

func TestStoreClear

func TestStoreClear(t *testing.T, s NewStoreFunc)

func TestStoreClearError

func TestStoreClearError(t *testing.T, s NewStoreFunc)

func TestStorePullError

func TestStorePullError(t *testing.T, s NewStoreFunc)

func TestStorePullWriterError

func TestStorePullWriterError(t *testing.T, s NewStoreFunc)

func TestStorePushError

func TestStorePushError(t *testing.T, s NewStoreFunc)

func TestStorePushPull

func TestStorePushPull(t *testing.T, s NewStoreFunc)

func TestStorePushReaderError

func TestStorePushReaderError(t *testing.T, s NewStoreFunc)

func TestStorePushReaderPullWriter

func TestStorePushReaderPullWriter(t *testing.T, s NewStoreFunc)

Types

type NewStoreFunc

type NewStoreFunc func() (Store, error)

type Store

type Store interface {
	// Push pushes data to the key-value store.
	Push(key string, data []byte) error

	// PushReader is like Push but reads the data from r.
	PushReader(key string, r io.Reader) error

	// Pull pulls data from the the key-value store.
	Pull(key string) ([]byte, error)

	// PullWriter is like Pull but writes the data to r.
	PullWriter(key string, w io.Writer) error

	// Clear removes data associated with a given key.
	Clear(key string) error
}

Store is the interface for interacting with an key-value store.

Directories

Path Synopsis
Package fs provides a local filesystem implementation of the kv.Store interface.
Package fs provides a local filesystem implementation of the kv.Store interface.
Package mem provides a in-memory implementation of the kv.Store interface.
Package mem provides a in-memory implementation of the kv.Store interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL