atomic

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSessionActive    = errors.New("session already active")
	ErrSessionNotActive = errors.New("session not active")
	ErrTxnActive        = errors.New("transaction already active")
	ErrTxnNotActive     = errors.New("transaction not active")
)

Functions

This section is empty.

Types

type AtomicKV

type AtomicKV struct {
	// contains filtered or unexported fields
}

AtomicKV is a threadsafe, linearizable key/value store.

func NewAtomicKV

func NewAtomicKV(store kv.KVStore) (*AtomicKV, error)

NewAtomicKV creates a new atomic key value store. It is compatible with Kwil's 2pc protocol.

func (*AtomicKV) Apply

func (k *AtomicKV) Apply(ctx context.Context, changes []byte) error

func (*AtomicKV) BeginApply

func (k *AtomicKV) BeginApply(ctx context.Context) error

func (*AtomicKV) BeginCommit

func (k *AtomicKV) BeginCommit(ctx context.Context) error

func (*AtomicKV) Cancel

func (k *AtomicKV) Cancel(ctx context.Context) error

func (*AtomicKV) Delete

func (k *AtomicKV) Delete(key []byte) error

Delete deletes a key from the database.

func (*AtomicKV) EndApply

func (k *AtomicKV) EndApply(ctx context.Context) error

func (*AtomicKV) EndCommit

func (k *AtomicKV) EndCommit(ctx context.Context, appender func([]byte) error) (err error)

func (*AtomicKV) Get

func (k *AtomicKV) Get(key []byte) ([]byte, error)

Read reads a key from the database.

func (*AtomicKV) ID

func (k *AtomicKV) ID(ctx context.Context) ([]byte, error)

func (*AtomicKV) NewPrefix

func (k *AtomicKV) NewPrefix(prefix []byte) *AtomicKV

NewPrefix creates a new writer with a prefix for the current store.

func (*AtomicKV) Set

func (k *AtomicKV) Set(key []byte, value []byte) error

Write writes a key/value pair to the database.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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