storage

package
v0.0.0-...-a1dc72b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: AGPL-3.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage interface {
	// Get returns the value associated with the specified key, or an error if the key is not found.
	Get(key string) ([]byte, error)

	// Set sets the value associated with the specified key.
	// If the key already exists, its value is updated.
	Set(key string, val []byte) error

	// Delete removes the value associated with the specified key from the database.
	Delete(key string) error

	// Iterate is similar to View, but allows the iteration to start from a specific key prefix.
	// The seekThenIterateKey parameter can be used to specify a key to seek to before starting the iteration.
	Iterate(processFunc func(key, value []byte) error) error

	IterateWithFilterByKeys(ks []string, processFunc func(key, value []byte) error) error

	// Close closes the database, releasing any system resources it holds.
	Close() error

	OpenTransaction() error

	CommitTransaction() error

	DiscardTransaction()
}

Storage interface defines the methods that can be used to interact with a key-value database.

Directories

Path Synopsis
database
memory

Jump to

Keyboard shortcuts

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