kvs

package
v2.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

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