keyvalue

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beginner

type Beginner interface {
	// Begin begins a transaction or sub-transaction with a prefix applied to keys.
	Begin(prefix *database.Key, writable bool) ChangeSet
}

A Beginner can begin key-value change sets.

type ChangeSet

type ChangeSet interface {
	Store
	Beginner

	// Commit commits pending changes.
	Commit() error

	// Discard discards pending changes.
	Discard()
}

ChangeSet is a key-value change set.

type RecordStore

type RecordStore struct {
	Store Store
}

RecordStore implements database.Store.

func (RecordStore) GetValue

func (s RecordStore) GetValue(key *record.Key, value database.Value) error

GetValue loads the raw value and calls value.LoadBytes.

func (RecordStore) PutValue

func (s RecordStore) PutValue(key *record.Key, value database.Value) error

PutValue marshals the value and stores it.

func (RecordStore) Unwrap

func (s RecordStore) Unwrap() Store

Unwrap returns the underlying store.

type Store

type Store interface {
	// Get loads a value.
	Get(*record.Key) ([]byte, error)

	// Put stores a value.
	Put(*record.Key, []byte) error

	// Delete deletes a key-value pair.
	Delete(*record.Key) error

	// ForEach iterates over each value.
	ForEach(func(*record.Key, []byte) error) error
}

Store is a key-value store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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