kvs

package
v2.7.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: BSD-3-Clause Imports: 7 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kvs provides functionalities needed for storing key-value pairs on Swarm.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNothingToSave indicates that no new key-value pair was added to the store.
	ErrNothingToSave = errors.New("nothing to save")
	// ErrNotFound is returned when an Entry is not found in the storage.
	ErrNotFound = errors.New("kvs entry not found")
)

Functions

This section is empty.

Types

type KeyValueStore

type KeyValueStore interface {
	// Get retrieves the value associated with the given key.
	Get(ctx context.Context, key []byte) ([]byte, error)
	// Put stores the given key-value pair in the store.
	Put(ctx context.Context, key, value []byte) error
	// Save saves key-value pair to the underlying storage and returns the reference.
	Save(ctx context.Context) (swarm.Address, error)
}

KeyValueStore represents a key-value store.

func New

func New(ls file.LoadSaver) (KeyValueStore, error)

New creates a new key-value store with a simple manifest.

func NewReference

func NewReference(ls file.LoadSaver, ref swarm.Address) (KeyValueStore, error)

NewReference loads a key-value store with a simple manifest.

Directories

Path Synopsis
Package mock provides an in-memory key-value store implementation.
Package mock provides an in-memory key-value store implementation.

Jump to

Keyboard shortcuts

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