store

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataNotFound = errors.New("no data found for this key")
)
View Source
var Factories = map[string]func(conf Conf) (DB, error){}

Factories of database

Functions

func ByteToU64

func ByteToU64(v []byte) uint64

ByteToU64 converts bytes to uint64

func U64ToByte

func U64ToByte(v uint64) []byte

U64ToByte converts uint64 to bytes

func U64U64ToByte

func U64U64ToByte(sid, ts uint64) []byte

U64U64ToByte converts two uint64 to bytes

Types

type BatchBucket added in v2.2.3

type BatchBucket interface {
	Set(offset uint64, value []byte) error
	Get(offset uint64, length int, op func([]byte, uint64) error) error
	MaxOffset() (uint64, error)
	DelBeforeID(uint64) error
	DelBeforeTS(ts uint64) error
	Close(clean bool) (err error)
}

BatchBucket the backend database

type Conf

type Conf struct {
	Driver string `yaml:"driver" json:"driver" default:"pebble"`
	Path   string `yaml:"path" json:"path" default:"var/lib/baetyl/db"`
}

Conf the configuration of database

type DB

type DB interface {
	NewBatchBucket(name string) (BatchBucket, error)
	NewKVBucket(name string) (KVBucket, error)

	io.Closer
}

func New

func New(conf Conf) (DB, error)

New DB by given name

type KVBucket added in v2.2.3

type KVBucket interface {
	SetKV(key []byte, value []byte) error
	GetKV(key []byte, op func([]byte) error) error
	DelKV(key []byte) error
	ListKV(op func([]byte) error) error
}

KVBucket the backend database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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