olddb

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ethdb defines the interfaces for an Ethereum data store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBatch

func NewBatch(tx kv.RwTx, quit <-chan struct{}) *mutation

NewBatch - starts in-mem batch

Common pattern:

batch := db.NewBatch() defer batch.Rollback() ... some calculations on `batch` batch.Commit()

func NewHashBatch

func NewHashBatch(tx kv.RwTx, quit <-chan struct{}, tmpdir string) *mapmutation

NewBatch - starts in-mem batch

Common pattern:

batch := db.NewBatch() defer batch.Rollback() ... some calculations on `batch` batch.Commit()

Types

type MutationItem

type MutationItem struct {
	// contains filtered or unexported fields
}

func (*MutationItem) Less

func (mi *MutationItem) Less(than btree.Item) bool

type ObjectDatabase

type ObjectDatabase struct {
	// contains filtered or unexported fields
}

ObjectDatabase - is an object-style interface of DB accessing

func NewObjectDatabase

func NewObjectDatabase(kv kv.RwDB) *ObjectDatabase

NewObjectDatabase returns a AbstractDB wrapper. Deprecated

func (*ObjectDatabase) Append

func (db *ObjectDatabase) Append(bucket string, key []byte, value []byte) error

Append appends a single entry to the end of the bucket.

func (*ObjectDatabase) AppendDup

func (db *ObjectDatabase) AppendDup(bucket string, key []byte, value []byte) error

AppendDup appends a single entry to the end of the bucket.

func (*ObjectDatabase) Begin

func (*ObjectDatabase) BucketExists

func (db *ObjectDatabase) BucketExists(name string) (bool, error)

func (*ObjectDatabase) ClearBuckets

func (db *ObjectDatabase) ClearBuckets(buckets ...string) error

func (*ObjectDatabase) Close

func (db *ObjectDatabase) Close()

func (*ObjectDatabase) Delete

func (db *ObjectDatabase) Delete(table string, k []byte) error

Delete deletes the key from the queue and database

func (*ObjectDatabase) DropBuckets

func (db *ObjectDatabase) DropBuckets(buckets ...string) error

func (*ObjectDatabase) ForAmount

func (db *ObjectDatabase) ForAmount(bucket string, fromPrefix []byte, amount uint32, walker func(k, v []byte) error) error

func (*ObjectDatabase) ForEach

func (db *ObjectDatabase) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) error) error

func (*ObjectDatabase) ForPrefix

func (db *ObjectDatabase) ForPrefix(bucket string, prefix []byte, walker func(k, v []byte) error) error

func (*ObjectDatabase) Get

func (db *ObjectDatabase) Get(bucket string, key []byte) ([]byte, error)

func (*ObjectDatabase) GetOne

func (db *ObjectDatabase) GetOne(bucket string, key []byte) ([]byte, error)

Get returns the value for a given key if it's present.

func (*ObjectDatabase) Has

func (db *ObjectDatabase) Has(bucket string, key []byte) (bool, error)

func (*ObjectDatabase) IncrementSequence

func (db *ObjectDatabase) IncrementSequence(bucket string, amount uint64) (res uint64, err error)

func (*ObjectDatabase) Last

func (db *ObjectDatabase) Last(bucket string) ([]byte, []byte, error)

func (*ObjectDatabase) Put

func (db *ObjectDatabase) Put(table string, k, v []byte) error

Put inserts or updates a single entry.

func (*ObjectDatabase) ReadSequence

func (db *ObjectDatabase) ReadSequence(bucket string) (res uint64, err error)

func (*ObjectDatabase) RwKV

func (db *ObjectDatabase) RwKV() kv.RwDB

func (*ObjectDatabase) SetRwKV

func (db *ObjectDatabase) SetRwKV(kv kv.RwDB)

type TxDb

type TxDb struct {
	// contains filtered or unexported fields
}

TxDb - provides Database interface around ethdb.Tx It's not thread-safe! TxDb not usable after .Commit()/.Rollback() call, but usable after .CommitAndBegin() call you can put unlimited amount of data into this class Walk and MultiWalk methods - work outside of Tx object yet, will implement it later Deprecated nolint

func WrapIntoTxDB

func WrapIntoTxDB(tx kv.RwTx) *TxDb

nolint

func (*TxDb) Append

func (m *TxDb) Append(bucket string, key []byte, value []byte) error

func (*TxDb) AppendDup

func (m *TxDb) AppendDup(bucket string, key []byte, value []byte) error

func (*TxDb) BatchSize

func (m *TxDb) BatchSize() int

func (*TxDb) Begin

func (*TxDb) BucketExists

func (m *TxDb) BucketExists(name string) (bool, error)

func (*TxDb) ClearBuckets

func (m *TxDb) ClearBuckets(buckets ...string) error

func (*TxDb) Close

func (m *TxDb) Close()

func (*TxDb) Commit

func (m *TxDb) Commit() error

func (*TxDb) Delete

func (m *TxDb) Delete(table string, k []byte) error

func (*TxDb) DropBuckets

func (m *TxDb) DropBuckets(buckets ...string) error

func (*TxDb) ForAmount

func (m *TxDb) ForAmount(bucket string, prefix []byte, amount uint32, walker func(k, v []byte) error) error

func (*TxDb) ForEach

func (m *TxDb) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) error) error

func (*TxDb) ForPrefix

func (m *TxDb) ForPrefix(bucket string, prefix []byte, walker func(k, v []byte) error) error

func (*TxDb) Get

func (m *TxDb) Get(bucket string, key []byte) ([]byte, error)

func (*TxDb) GetOne

func (m *TxDb) GetOne(bucket string, key []byte) ([]byte, error)

func (*TxDb) Has

func (m *TxDb) Has(bucket string, key []byte) (bool, error)

func (*TxDb) IncrementSequence

func (m *TxDb) IncrementSequence(bucket string, amount uint64) (res uint64, err error)

func (*TxDb) Last

func (m *TxDb) Last(bucket string) ([]byte, []byte, error)

Last can only be called from the transaction thread

func (*TxDb) Put

func (m *TxDb) Put(table string, k, v []byte) error

func (*TxDb) ReadSequence

func (m *TxDb) ReadSequence(bucket string) (res uint64, err error)

func (*TxDb) Rollback

func (m *TxDb) Rollback()

func (*TxDb) RwKV

func (m *TxDb) RwKV() kv.RwDB

func (*TxDb) Tx

func (m *TxDb) Tx() kv.Tx

Jump to

Keyboard shortcuts

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