storager

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 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