backend

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Name returns the name of the store
	Name() string
	String() string
	Persistent() bool
	Close() error
	Reader
	Writer
	BatchWriter
}

type BatchWriter

type BatchWriter interface {
	SetAll(kayVals []KeyVal, expiry time.Duration) error
	Close() error
}

type Builder

type Builder func(name string) (Backend, error)

type Cache

type Cache interface {
	Reader
	Writer
	Reset()
}

type CacheableBackend

type CacheableBackend interface {
	Cache() Cache
}

type Iterator

type Iterator interface {
	SeekToFirst()
	SeekToLast()
	Seek(key []byte)
	Next()
	Prev()
	Close()
	Key() []byte
	Value() []byte
	Valid() bool
	Error() error
}

type KeyVal

type KeyVal struct {
	Key, Val []byte
}

type Reader

type Reader interface {
	// Get looks for the value of a given key. Will return nil if the value does not exist
	Get(key []byte) ([]byte, error)
	PrefixedIterator(keyPrefix []byte) Iterator
	Iterator() Iterator
	Close() error
}

type Writer

type Writer interface {
	// Set writes the given key:value pair with an optional expiry
	Set(key []byte, value []byte, expiry time.Duration) error
	Delete(key []byte) error
	DeleteAll() error
	Flush() error
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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