storage

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespaceTerminator is the uint8 that terminates a namespace.
	NamespaceTerminator = 0x00
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Namespaced

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

Namespaced defines a higher level storage layer that saves bytes in a prefix.

func NewNamespaced

func NewNamespaced(namespace string) Namespaced

NewNamespaced generates a new Namespaced instance given a unique namespace.

func (Namespaced) Get

func (s Namespaced) Get(storage std.Storage, key []byte) []byte

Get gets the given key after prepending the namespace prefix.

func (Namespaced) Range

func (s Namespaced) Range(storage std.Storage, start, end []byte, order std.Order) std.Iterator

Range ranges over the given start to end range after prepending the namespace prefix.

func (Namespaced) Remove

func (s Namespaced) Remove(storage std.Storage, key []byte)

Remove removes the given key after prepending the namespace prefix.

func (Namespaced) Set

func (s Namespaced) Set(storage std.Storage, key, value []byte)

Set sets key and value after prepending the namespace prefix.

type NamespacedIterator

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

NamespacedIterator is the std.Iterator of namespaced storage.

func (NamespacedIterator) Next

func (n NamespacedIterator) Next() (key, value []byte, err error)

Next returns the next key value combo in the iterator, it removes the namespace prefix from key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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