database

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	DB      storage.KeyValueDB // Underlying database implementation
	Buckets map[string]byte    // two bytes indicating a bucket
	TXList  TXList             // Transaction List
}

func (*Manager) AddBucket

func (m *Manager) AddBucket(bucket string)

AddBucket Add a bucket to be used in the database. Initializing a database requires that buckets and labels be added in the correct order.

func (*Manager) BeginBatch added in v0.0.14

func (m *Manager) BeginBatch()

func (*Manager) Close

func (m *Manager) Close()

Close Do any cleanup required to close the manager

func (*Manager) EndBatch added in v0.0.14

func (m *Manager) EndBatch()

func (*Manager) Get

func (m *Manager) Get(Bucket string, key []byte) (value []byte)

Get Get a []byte value from the underlying database. Returns a nil if not found, or on an error

func (*Manager) GetIndex

func (m *Manager) GetIndex(element []byte) int64

GetIndex Return the int64 value tied to the element hash in the ElementIndex bucket

func (*Manager) GetInt64

func (m *Manager) GetInt64(Bucket string, key []byte) (value int64)

GetInt64 Get a string value from the underlying database. Returns a nil if not found, or on an error

func (*Manager) GetKey

func (m *Manager) GetKey(Bucket string, key []byte) (DBKey [storage.KeyLength]byte)

GetKey Given a Bucket Name, a Label name, and a key, GetKey returns a single key to be used in a key/value database

func (*Manager) GetString

func (m *Manager) GetString(Bucket string, key []byte) (value string)

GetString Get a string value from the underlying database. Returns a nil if not found, or on an error

func (*Manager) Init

func (m *Manager) Init(database, filename string) error

Init Initialize the Manager with a specified underlying database

func (*Manager) Put

func (m *Manager) Put(Bucket string, key []byte, value []byte) (err error)

Put Put a []byte value into the underlying database

func (*Manager) PutBatch added in v0.0.14

func (m *Manager) PutBatch(Bucket string, key []byte, value []byte) error

func (*Manager) PutInt64

func (m *Manager) PutInt64(Bucket string, key []byte, value int64) error

PutInt64 Put a int64 value into the underlying database

func (*Manager) PutString

func (m *Manager) PutString(Bucket string, key []byte, value string) error

PutString Put a String value into the underlying database

type TXList added in v0.0.14

type TXList struct {
	List []storage.TX
}

func (*TXList) Put added in v0.0.14

func (b *TXList) Put(key [storage.KeyLength]byte, value []byte) error

PutBatch Put a key value pair into a batch. These commits are effectively pending and will only be written to the database if the batch is passed to PutBatch

Jump to

Keyboard shortcuts

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