kv

package
v0.0.0-...-3b62d95 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	BeginTransaction(ctx context.Context) (Transaction, error)
	Transact(func(Transaction) (any, error)) (any, error)
	Close(ctx context.Context) error
	UnsafeWipeAll() error
}

Store is a generic interface for a transactional, sorted KV store. It is used to abstract over various KV implementation so we can implement the registry generically in kv_registry.go and still use all the logic/code for multiple KV backends.

type Transaction

type Transaction interface {
	Put(ctx context.Context, key []byte, value []byte) error
	Get(ctx context.Context, key []byte) ([]byte, bool, error)
	IterPrefix(ctx context.Context, prefix []byte, fn func(k, v []byte) error) error
	// Monotonically increase number that should increase at a rate of ~ 1 million
	// per second.
	GetVersionStamp() (int64, error)
	Commit(ctx context.Context) error
	Cancel(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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