kv

package
v2.7.0-nightly.20230525 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetPut

type GetPut interface {
	// Get looks up the value that corresponds to key and calls cb once if the key exists
	// if the key does not exist then a pacherr.ErrNotExist is returned
	Get(ctx context.Context, key []byte, cb ValueCallback) error
	// Put creates an entry mapping key to value, overwriting any previous mapping.
	Put(ctx context.Context, key, value []byte) error
}

GetPut supports the basic Get and Put operations

func NewMemCache

func NewMemCache(size int) GetPut

NewMemCache returns a new in memory cache

type Store

type Store interface {
	GetPut
	Delete(ctx context.Context, key []byte) error
	Exists(ctx context.Context, key []byte) (bool, error)
	Walk(ctx context.Context, prefix []byte, cb func(key []byte) error) error
}

Store is a key-value store

func NewFromObjectClient

func NewFromObjectClient(objC obj.Client) Store

NewFromObjectClient converts an object client into a key value store. This can provide more natural interface for small values, but it will read the entire object into memory

type ValueCallback

type ValueCallback = func([]byte) error

ValueCallback is the type of functions used to access values

Jump to

Keyboard shortcuts

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