db

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HashSize means the length of hash string.
	HashSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

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

Batch interface is defined to deal for a series of data.

func NewBatch

func NewBatch() Batch

NewBatch creates a batch instance.

type Cache

type Cache interface {
	Put(key []byte, value []byte)
	Get(key []byte) ([]byte, error)
	Delete(key []byte) error
}

Cache interface is used for cache data from database.

type DB

type DB interface {
	Get(key []byte) ([]byte, error)
	Put(key []byte, value []byte) error
	Delete(key []byte) error
	Has(key []byte) (bool, error)
	StartTransactionRecord()
	CommitTransaction()
	Close() error
	GetIter() iterator.Iterator
}

DB interface is used for database.

func OpenDB

func OpenDB(dataDir string, namespace string) (DB, error)

OpenDB returns a wrapped leveldb instance(currently).

Jump to

Keyboard shortcuts

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