Documentation
¶
Overview ¶
Package ethdb defines the interfaces for an Ethereum data store.
Index ¶
- func NewBatch(tx kv.RwTx, quit <-chan struct{}) *mutation
- func NewHashBatch(tx kv.RwTx, quit <-chan struct{}, tmpdir string) *mapmutation
- type MutationItem
- type ObjectDatabase
- func (db *ObjectDatabase) Append(bucket string, key []byte, value []byte) error
- func (db *ObjectDatabase) AppendDup(bucket string, key []byte, value []byte) error
- func (db *ObjectDatabase) Begin(ctx context.Context, flags ethdb.TxFlags) (ethdb.DbWithPendingMutations, error)
- func (db *ObjectDatabase) BucketExists(name string) (bool, error)
- func (db *ObjectDatabase) ClearBuckets(buckets ...string) error
- func (db *ObjectDatabase) Close()
- func (db *ObjectDatabase) Delete(table string, k []byte) error
- func (db *ObjectDatabase) DropBuckets(buckets ...string) error
- func (db *ObjectDatabase) ForAmount(bucket string, fromPrefix []byte, amount uint32, ...) error
- func (db *ObjectDatabase) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) error) error
- func (db *ObjectDatabase) ForPrefix(bucket string, prefix []byte, walker func(k, v []byte) error) error
- func (db *ObjectDatabase) Get(bucket string, key []byte) ([]byte, error)
- func (db *ObjectDatabase) GetOne(bucket string, key []byte) ([]byte, error)
- func (db *ObjectDatabase) Has(bucket string, key []byte) (bool, error)
- func (db *ObjectDatabase) IncrementSequence(bucket string, amount uint64) (res uint64, err error)
- func (db *ObjectDatabase) Last(bucket string) ([]byte, []byte, error)
- func (db *ObjectDatabase) Put(table string, k, v []byte) error
- func (db *ObjectDatabase) ReadSequence(bucket string) (res uint64, err error)
- func (db *ObjectDatabase) RwKV() kv.RwDB
- func (db *ObjectDatabase) SetRwKV(kv kv.RwDB)
- type TxDb
- func (m *TxDb) Append(bucket string, key []byte, value []byte) error
- func (m *TxDb) AppendDup(bucket string, key []byte, value []byte) error
- func (m *TxDb) BatchSize() int
- func (m *TxDb) Begin(ctx context.Context, flags ethdb.TxFlags) (ethdb.DbWithPendingMutations, error)
- func (m *TxDb) BucketExists(name string) (bool, error)
- func (m *TxDb) ClearBuckets(buckets ...string) error
- func (m *TxDb) Close()
- func (m *TxDb) Commit() error
- func (m *TxDb) Delete(table string, k []byte) error
- func (m *TxDb) DropBuckets(buckets ...string) error
- func (m *TxDb) ForAmount(bucket string, prefix []byte, amount uint32, walker func(k, v []byte) error) error
- func (m *TxDb) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) error) error
- func (m *TxDb) ForPrefix(bucket string, prefix []byte, walker func(k, v []byte) error) error
- func (m *TxDb) Get(bucket string, key []byte) ([]byte, error)
- func (m *TxDb) GetOne(bucket string, key []byte) ([]byte, error)
- func (m *TxDb) Has(bucket string, key []byte) (bool, error)
- func (m *TxDb) IncrementSequence(bucket string, amount uint64) (res uint64, err error)
- func (m *TxDb) Last(bucket string) ([]byte, []byte, error)
- func (m *TxDb) Put(table string, k, v []byte) error
- func (m *TxDb) ReadSequence(bucket string) (res uint64, err error)
- func (m *TxDb) Rollback()
- func (m *TxDb) RwKV() kv.RwDB
- func (m *TxDb) Tx() kv.Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBatch ¶
NewBatch - starts in-mem batch
Common pattern:
batch := db.NewBatch() defer batch.Rollback() ... some calculations on `batch` batch.Commit()
func NewHashBatch ¶
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
}
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 (db *ObjectDatabase) Begin(ctx context.Context, flags ethdb.TxFlags) (ethdb.DbWithPendingMutations, error)
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) 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) IncrementSequence ¶
func (db *ObjectDatabase) IncrementSequence(bucket string, amount uint64) (res uint64, err 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