Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCompatibility(dbtype, storPath string) error
- func ReadVersion(path string) (string, int32, error)
- func RegisterDriver(instance StorageDriver)
- func RegisteredDbTypes() []string
- func WriteVersion(path, dbtype string, version int32) error
- type Batch
- type Iterator
- type Range
- type Storage
- type StorageDriver
Constants ¶
View Source
const ( // StorageV1 // - initial StorageV1 int32 = 1 + iota // StorageV2 // - record bitlength associated with poc pk StorageV2 // StorageV3 // - since 1.1.0 // - save blocks to disk StorageV3 CurrentStorageVersion int32 = StorageV3 )
View Source
const ( KiB = 1024 MiB = KiB * 1024 GiB = MiB * 1024 )
Variables ¶
View Source
var ( ErrDbUnknownType = errors.New("non-existent database type") ErrInvalidKey = errors.New("invalid key") ErrInvalidValue = errors.New("invalid value") ErrInvalidBatch = errors.New("invalid batch") ErrInvalidArgument = errors.New("invalid argument") ErrNotFound = errors.New("not found") ErrIncompatibleStorage = errors.New("incompatible storage") )
Functions ¶
func CheckCompatibility ¶
func RegisterDriver ¶
func RegisterDriver(instance StorageDriver)
func RegisteredDbTypes ¶
func RegisteredDbTypes() []string
func WriteVersion ¶
Types ¶
type Range ¶
type Range struct { // Start of the key range, include in the range. Start []byte // Limit of the key range, not include in the range. Limit []byte }
Range is a key range.
func BytesPrefix ¶
type Storage ¶
type Storage interface { Close() error // Get returns ErrNotFound if key not exist Get(key []byte) ([]byte, error) Put(key, value []byte) error Has(key []byte) (bool, error) Delete(key []byte) error Write(batch Batch) error NewBatch() Batch NewIterator(slice *Range) Iterator }
func CreateStorage ¶
CreateStorage intializes and opens a database.
Click to show internal directories.
Click to hide internal directories.