db

package
v0.0.0-...-a345a4b Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics

func InitMetrics(registry *prometheus.Registry)

InitMetrics registers all metrics in this file

Types

type Batch

type Batch interface {
	Put(key, value []byte)
	Delete(key []byte)
	Commit() error
	Count() uint32
	Repr() []byte
	Reset()
}

A Batch is a sequence of Puts and Deletes that Commit to DB.

type DB

type DB interface {
	Iterator(lowerBound, upperBound []byte) Iterator
	Batch(cap int) Batch
	Compact(start, end []byte) error
	Close() error
	CollectMetrics(captureAddr string, id int)
}

DB is an interface of a leveldb-like database.

func OpenLevelDB

func OpenLevelDB(ctx context.Context, id int, path string, cfg *config.DBConfig) (DB, error)

OpenLevelDB opens a leveldb.

func OpenPebble

func OpenPebble(ctx context.Context, id int, path string, cfg *config.DBConfig) (DB, error)

OpenPebble opens a pebble.

type Iterator

type Iterator interface {
	Valid() bool
	First() bool
	Seek([]byte) bool
	Next() bool
	Key() []byte
	Value() []byte
	Error() error
	Release() error
}

Iterator is an interface of an iterator of a DB.

Jump to

Keyboard shortcuts

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