storager

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageType

type StorageType int
const (
	Bolt StorageType = iota
	Leveldb
	Default = Bolt
)

TODO: support badger. types of storage

type Storager

type Storager interface {
	List() ([][]byte, error)                    // list all values
	Get(key string) ([]byte, error)             // get a value along with key
	Set(key string, value []byte) error         // set a key, value pair
	Batch(keys []string, values [][]byte) error // batch set key, value pairs
	Delete(key string) error                    // delete a key, value pair
	DeleteAll() error                           // delete all key, value pairs
	CloneDatabase(newPath string) error         // clone the database to the newPath
	Type() string                               // return the underlying type of db
	Close() error                               // close the db
}

func NewStorager

func NewStorager(st StorageType, dbPath string) (Storager, error)

Jump to

Keyboard shortcuts

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