olddb

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright 2023 The AmazeChain Authors This file is part of the AmazeChain library.

The AmazeChain library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The AmazeChain library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the AmazeChain library. If not, see <http://www.gnu.org/licenses/>. 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 StateReader

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

func NewStateReader

func NewStateReader(data map[string][]byte, codes map[types.Hash][]byte, db kv.Getter, blockNr uint64) *StateReader

func (*StateReader) GetOne

func (dbr *StateReader) GetOne(bucket string, key []byte) ([]byte, error)

func (*StateReader) ReadAccountCode

func (r *StateReader) ReadAccountCode(address types.Address, incarnation uint16, codeHash types.Hash) ([]byte, error)

func (*StateReader) ReadAccountCodeSize

func (r *StateReader) ReadAccountCodeSize(address types.Address, incarnation uint16, codeHash types.Hash) (int, error)

func (*StateReader) ReadAccountData

func (r *StateReader) ReadAccountData(address types.Address) (*account.StateAccount, error)

func (*StateReader) ReadAccountIncarnation

func (r *StateReader) ReadAccountIncarnation(address types.Address) (uint16, error)

func (*StateReader) ReadAccountStorage

func (r *StateReader) ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)

func (*StateReader) SetBlockNumber

func (dbr *StateReader) SetBlockNumber(blockNr uint64)

func (*StateReader) SetReadCodeF

func (dbr *StateReader) SetReadCodeF(readCodeF func(types.Hash) ([]byte, error))

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