Documentation

Overview

    Package ethdb defines the interfaces for an Ethereum data store.

    Index

    Constants

    View Source
    const (
    	NonExistingDBI = 999_999_999
    )

    Variables

    View Source
    var (
    	ErrAttemptToDeleteNonDeprecatedBucket = errors.New("only buckets from dbutils.DeprecatedBuckets can be deleted")
    	ErrUnknownBucket                      = errors.New("unknown bucket. add it to dbutils.Buckets")
    )
    View Source
    var DefaultBucketConfigs = func(defaultBuckets dbutils.BucketsCfg) dbutils.BucketsCfg {
    	return defaultBuckets
    }
    View Source
    var DefaultStorageMode = StorageMode{History: true, Receipts: true, TxIndex: true}
    View Source
    var EndSuffix = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
    View Source
    var ErrKeyNotFound = errors.New("db: key not found")

      ErrKeyNotFound is returned when key isn't found in the database.

      View Source
      var (
      	LMDBMapSize = 2 * datasize.TB
      )

      Functions

      func Bytesmask

      func Bytesmask(fixedbits int) (fixedbytes int, mask byte)

      func ForEach

      func ForEach(c Cursor, walker func([]byte, []byte) (bool, error)) error

      func Get

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

      func GetChangeSetByBlock

      func GetChangeSetByBlock(db Getter, storage bool, timestamp uint64) ([]byte, error)

      func GetModifiedAccounts

      func GetModifiedAccounts(db Getter, startTimestamp, endTimestamp uint64) ([]common.Address, error)

      func HackAddRootToAccountBytes

      func HackAddRootToAccountBytes(accNoRoot []byte, root []byte) (accWithRoot []byte, err error)

      func InspectDatabase

      func InspectDatabase(db Database) error

      func MultiPut

      func MultiPut(tx Tx, tuples ...[]byte) error

      func MultiWalk

      func MultiWalk(c Cursor, startkeys [][]byte, fixedbits []int, walker func(int, []byte, []byte) error) error

      func NewBolt

      func NewBolt() boltOpts

      func NewLMDB

      func NewLMDB() lmdbOpts

      func NewRemote

      func NewRemote() remoteOpts

      func NewSplitCursor

      func NewSplitCursor(c Cursor, startkey []byte, matchBits int, part1end, part2start, part3start int) *splitCursor

      func RewindData

      func RewindData(db Getter, timestampSrc, timestampDst uint64) (map[string][]byte, map[string][]byte, error)

        RewindData generates rewind data for all buckets between the timestamp timestapSrc is the current timestamp, and timestamp Dst is where we rewind

        func RewindDataPlain

        func RewindDataPlain(db Getter, timestampSrc, timestampDst uint64) (map[string][]byte, map[string][]byte, error)

          RewindDataPlain generates rewind data for all plain buckets between the timestamp timestapSrc is the current timestamp, and timestamp Dst is where we rewind

          func SetStorageModeIfNotExist

          func SetStorageModeIfNotExist(db Database, sm StorageMode) error

          func Walk

          func Walk(c Cursor, startkey []byte, fixedbits int, walker func([]byte, []byte) (bool, error)) error

          Types

          type Backend

          type Backend interface {
          	AddLocal([]byte) ([]byte, error)
          	Etherbase() (common.Address, error)
          	NetVersion() (uint64, error)
          }

          type BoltKV

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

          func (*BoltKV) AllBuckets

          func (db *BoltKV) AllBuckets() dbutils.BucketsCfg

          func (*BoltKV) Begin

          func (db *BoltKV) Begin(ctx context.Context, parent Tx, writable bool) (Tx, error)

          func (*BoltKV) BucketsStat

          func (db *BoltKV) BucketsStat(_ context.Context) (map[string]common.StorageBucketWriteStats, error)

          func (*BoltKV) Close

          func (db *BoltKV) Close()

            Close closes BoltKV All transactions must be closed before closing the database.

            func (*BoltKV) DiskSize

            func (db *BoltKV) DiskSize(_ context.Context) (uint64, error)

            func (*BoltKV) Update

            func (db *BoltKV) Update(ctx context.Context, f func(tx Tx) error) (err error)

            func (*BoltKV) View

            func (db *BoltKV) View(ctx context.Context, f func(tx Tx) error) (err error)

            type BucketConfigsFunc

            type BucketConfigsFunc func(defaultBuckets dbutils.BucketsCfg) dbutils.BucketsCfg

            type BucketMigrator

            type BucketMigrator interface {
            	DropBucket(string) error
            	CreateBucket(string) error
            	ExistsBucket(string) bool
            	ClearBucket(string) error
            	ExistingBuckets() ([]string, error)
            }

              Interface used for buckets migration, don't use it in usual app code

              type Closer

              type Closer interface {
              	Close()
              }

              type Cursor

              type Cursor interface {
              	Prefix(v []byte) Cursor
              	Prefetch(v uint) Cursor
              
              	First() ([]byte, []byte, error)
              	Seek(seek []byte) ([]byte, []byte, error)
              	SeekExact(key []byte) ([]byte, error)
              	Next() ([]byte, []byte, error)
              	Last() ([]byte, []byte, error)
              
              	Put(key []byte, value []byte) error
              	Delete(key []byte) error
              	Append(key []byte, value []byte) error // Returns error if provided data not sorted or has duplicates
              }

              type DBCounterStats

              type DBCounterStats struct {
              	Put           uint64
              	Get           uint64
              	GetS          uint64
              	GetAsOf       uint64
              	Has           uint64
              	Walk          uint64
              	WalkAsOf      uint64
              	MultiWalk     uint64
              	MultiWalkAsOf uint64
              	Delete        uint64
              	MultiPut      uint64
              }

              type Database

              type Database interface {
              	Getter
              	Putter
              	Deleter
              	Closer
              
              	// MultiPut inserts or updates multiple entries.
              	// Entries are passed as an array:
              	// bucket0, key0, val0, bucket1, key1, val1, ...
              	MultiPut(tuples ...[]byte) (uint64, error)
              
              	// NewBatch - starts in-mem batch
              	//
              	// Common pattern:
              	//
              	// batch := db.NewBatch()
              	// defer batch.Rollback()
              	// ... some calculations on `batch`
              	// batch.Commit()
              	//
              	NewBatch() DbWithPendingMutations       //
              	Begin() (DbWithPendingMutations, error) // starts db transaction
              	Last(bucket string) ([]byte, []byte, error)
              
              	// IdealBatchSize defines the size of the data batches should ideally add in one write.
              	IdealBatchSize() int
              
              	Keys() ([][]byte, error)
              
              	// [TURBO-GETH] Freezer support (minimum amount that is actually used)
              	// FIXME: implement support if needed
              	Ancients() (uint64, error)
              	TruncateAncients(items uint64) error
              	Append(bucket string, key, value []byte) error
              }

                Database wraps all database operations. All methods are safe for concurrent use.

                type DbProvider

                type DbProvider uint8
                const (
                	Bolt DbProvider = iota
                	Remote
                	Lmdb
                )

                type DbWithPendingMutations

                type DbWithPendingMutations interface {
                	Database
                
                	// Commit - commits transaction (or flush data into underlying db object in case of `mutation`)
                	//
                	// Common pattern:
                	//
                	// tx := db.Begin()
                	// defer tx.Rollback()
                	// ... some calculations on `tx`
                	// tx.Commit()
                	//
                	Commit() (uint64, error)
                
                	// CommitAndBegin - commits and starts new transaction inside same db object.
                	// useful for periodical commits implementation.
                	//
                	// Common pattern:
                	//
                	// tx := db.Begin()
                	// defer tx.Rollback()
                	// for {
                	// 		... some calculations on `tx`
                	//       tx.CommitAndBegin()
                	//       // defer here - is not useful, because 'tx' object is reused and first `defer` will work perfectly
                	// }
                	// tx.Commit()
                	//
                	CommitAndBegin() error
                	Rollback()
                	BatchSize() int
                }

                  DbWithPendingMutations is an extended version of the Database, where all changes are first made in memory. Later they can either be committed to the database or rolled back.

                  type Deleter

                  type Deleter interface {
                  	// Delete removes a single entry.
                  	Delete(bucket string, key []byte) error
                  }

                    Deleter wraps the database delete operations.

                    type Getter

                    type Getter interface {
                    	// Get returns the value for a given key if it's present.
                    	Get(bucket string, key []byte) ([]byte, error)
                    
                    	// Get returns prober chunk of index or error if index is not created.
                    	// Key must contain 8byte inverted block number in the end.
                    	GetIndexChunk(bucket string, key []byte, timestamp uint64) ([]byte, error)
                    
                    	// Has indicates whether a key exists in the database.
                    	Has(bucket string, key []byte) (bool, error)
                    
                    	// Walk iterates over entries with keys greater or equal to startkey.
                    	// Only the keys whose first fixedbits match those of startkey are iterated over.
                    	// walker is called for each eligible entry.
                    	// If walker returns false or an error, the walk stops.
                    	Walk(bucket string, startkey []byte, fixedbits int, walker func(k, v []byte) (bool, error)) error
                    
                    	// MultiWalk is similar to multiple Walk calls folded into one.
                    	MultiWalk(bucket string, startkeys [][]byte, fixedbits []int, walker func(int, []byte, []byte) error) error
                    }

                      Getter wraps the database read operations.

                      type GetterPutter

                      type GetterPutter interface {
                      	Getter
                      	Putter
                      }

                      type HasKV

                      type HasKV interface {
                      	KV() KV
                      }

                      type HasNetInterface

                      type HasNetInterface interface {
                      	DB() Database
                      }

                      type HasStats

                      type HasStats interface {
                      	DiskSize(context.Context) (uint64, error) // db size
                      }

                      type HasTx

                      type HasTx interface {
                      	Tx() Tx
                      }

                      type Iteratee

                      type Iteratee interface {
                      	// NewIterator creates a binary-alphabetical iterator over a subset
                      	// of database content with a particular key prefix, starting at a particular
                      	// initial key (or after, if it does not exist).
                      	//
                      	// Note: This method assumes that the prefix is NOT part of the start, so there's
                      	// no need for the caller to prepend the prefix to the start
                      	NewIterator(prefix []byte, start []byte) Iterator
                      }

                        Iteratee wraps the NewIterator methods of a backing data store.

                        type Iterator

                        type Iterator interface {
                        	// Next moves the iterator to the next key/value pair. It returns whether the
                        	// iterator is exhausted.
                        	Next() bool
                        
                        	// Error returns any accumulated error. Exhausting all the key/value pairs
                        	// is not considered to be an error.
                        	Error() error
                        
                        	// Key returns the key of the current key/value pair, or nil if done. The caller
                        	// should not modify the contents of the returned slice, and its contents may
                        	// change on the next call to Next.
                        	Key() []byte
                        
                        	// Value returns the value of the current key/value pair, or nil if done. The
                        	// caller should not modify the contents of the returned slice, and its contents
                        	// may change on the next call to Next.
                        	Value() []byte
                        
                        	// Release releases associated resources. Release should always succeed and can
                        	// be called multiple times without causing error.
                        	Release()
                        }

                          Iterator iterates over a database's key/value pairs in ascending key order.

                          When it encounters an error any seek will return false and will yield no key/ value pairs. The error can be queried by calling the Error method. Calling Release is still necessary.

                          An iterator must be released after use, but it is not necessary to read an iterator until exhaustion. An iterator is not safe for concurrent use, but it is safe to use multiple iterators concurrently.

                          type KV

                          type KV interface {
                          	View(ctx context.Context, f func(tx Tx) error) error
                          	Update(ctx context.Context, f func(tx Tx) error) error
                          	Close()
                          
                          	Begin(ctx context.Context, parent Tx, writable bool) (Tx, error)
                          	AllBuckets() dbutils.BucketsCfg
                          }

                          type LmdbCursor

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

                          func (*LmdbCursor) Append

                          func (c *LmdbCursor) Append(key []byte, value []byte) error

                            Append - speedy feature of lmdb which is not part of KV interface. Cast your cursor to *LmdbCursor to use this method. Danger: if provided data will not sorted (or bucket have old records which mess with new in sorting manner) - db will corrupt.

                            func (*LmdbCursor) AppendDup

                            func (c *LmdbCursor) AppendDup(key []byte, value []byte) error

                            func (*LmdbCursor) Close

                            func (c *LmdbCursor) Close() error

                            func (*LmdbCursor) Delete

                            func (c *LmdbCursor) Delete(key []byte) error

                            func (*LmdbCursor) First

                            func (c *LmdbCursor) First() ([]byte, []byte, error)

                            func (*LmdbCursor) Last

                            func (c *LmdbCursor) Last() ([]byte, []byte, error)

                            func (*LmdbCursor) Next

                            func (c *LmdbCursor) Next() (k, v []byte, err error)

                            func (*LmdbCursor) Prefetch

                            func (c *LmdbCursor) Prefetch(v uint) Cursor

                            func (*LmdbCursor) Prefix

                            func (c *LmdbCursor) Prefix(v []byte) Cursor

                            func (*LmdbCursor) Put

                            func (c *LmdbCursor) Put(key []byte, value []byte) error

                            func (*LmdbCursor) PutCurrent

                            func (c *LmdbCursor) PutCurrent(key []byte, value []byte) error

                            func (*LmdbCursor) Seek

                            func (c *LmdbCursor) Seek(seek []byte) (k, v []byte, err error)

                            func (*LmdbCursor) SeekBothExact

                            func (c *LmdbCursor) SeekBothExact(key, value []byte) ([]byte, []byte, error)

                            func (*LmdbCursor) SeekBothRange

                            func (c *LmdbCursor) SeekBothRange(key, value []byte) ([]byte, []byte, error)

                            func (*LmdbCursor) SeekExact

                            func (c *LmdbCursor) SeekExact(key []byte) ([]byte, error)

                            type LmdbKV

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

                            func (*LmdbKV) AllBuckets

                            func (db *LmdbKV) AllBuckets() dbutils.BucketsCfg

                            func (*LmdbKV) AllDBI

                            func (db *LmdbKV) AllDBI() map[string]lmdb.DBI

                            func (*LmdbKV) Begin

                            func (db *LmdbKV) Begin(ctx context.Context, parent Tx, writable bool) (Tx, error)

                            func (*LmdbKV) Close

                            func (db *LmdbKV) Close()

                              Close closes db All transactions must be closed before closing the database.

                              func (*LmdbKV) DiskSize

                              func (db *LmdbKV) DiskSize(_ context.Context) (uint64, error)

                              func (*LmdbKV) Env

                              func (db *LmdbKV) Env() *lmdb.Env

                              func (*LmdbKV) Update

                              func (db *LmdbKV) Update(ctx context.Context, f func(tx Tx) error) (err error)

                              func (*LmdbKV) View

                              func (db *LmdbKV) View(ctx context.Context, f func(tx Tx) error) (err error)

                              type MinDatabase

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

                                MinDatabase is a minimalistic version of the Database interface.

                                type MultiPutTuples

                                type MultiPutTuples [][]byte

                                  Type which expecting sequence of triplets: dbi, key, value, .... It sorts entries by dbi name, then inside dbi clusters sort by keys

                                  func (MultiPutTuples) Len

                                  func (t MultiPutTuples) Len() int

                                  func (MultiPutTuples) Less

                                  func (t MultiPutTuples) Less(i, j int) bool

                                  func (MultiPutTuples) Swap

                                  func (t MultiPutTuples) Swap(i, j int)

                                  type NoValuesCursor

                                  type NoValuesCursor interface {
                                  	First() ([]byte, uint32, error)
                                  	Seek(seek []byte) ([]byte, uint32, error)
                                  	Next() ([]byte, uint32, error)
                                  }

                                  type NonTransactional

                                  type NonTransactional interface {
                                  	BucketExists(bucket string) (bool, error) // makes them empty
                                  	ClearBuckets(buckets ...string) error     // makes them empty
                                  	DropBuckets(buckets ...string) error      // drops them, use of them after drop will panic
                                  }

                                  type ObjectDatabase

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

                                    ObjectDatabase - is an object-style interface of DB accessing

                                    func MustOpen

                                    func MustOpen(path string) *ObjectDatabase

                                    func NewDatabaseWithFreezer

                                    func NewDatabaseWithFreezer(db *ObjectDatabase, dir, suffix string) (*ObjectDatabase, error)

                                    func NewMemDatabase

                                    func NewMemDatabase() *ObjectDatabase

                                    func NewObjectDatabase

                                    func NewObjectDatabase(kv KV) *ObjectDatabase

                                      NewObjectDatabase returns a AbstractDB wrapper.

                                      func Open

                                      func Open(path string) (*ObjectDatabase, error)

                                        Open - main method to open database. Choosing driver based on path suffix. If env TEST_DB provided - choose driver based on it. Some test using this method to open non-in-memory db

                                        func (*ObjectDatabase) Ancients

                                        func (db *ObjectDatabase) Ancients() (uint64, error)

                                          [TURBO-GETH] Freezer support (not implemented yet) Ancients returns an error as we don't have a backing chain freezer.

                                          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) 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(bucket string, key []byte) error

                                              Delete deletes the key from the queue and database

                                              func (*ObjectDatabase) DiskSize

                                              func (db *ObjectDatabase) DiskSize(ctx context.Context) (uint64, error)

                                              func (*ObjectDatabase) DropBuckets

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

                                              func (*ObjectDatabase) Get

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

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

                                                func (*ObjectDatabase) GetIndexChunk

                                                func (db *ObjectDatabase) GetIndexChunk(bucket string, key []byte, timestamp uint64) ([]byte, error)

                                                  GetIndexChunk returns proper index chunk or return error if index is not created. key must contain inverted block number in the end

                                                  func (*ObjectDatabase) Has

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

                                                  func (*ObjectDatabase) IdealBatchSize

                                                  func (db *ObjectDatabase) IdealBatchSize() int

                                                    IdealBatchSize defines the size of the data batches should ideally add in one write.

                                                    func (*ObjectDatabase) KV

                                                    func (db *ObjectDatabase) KV() KV

                                                    func (*ObjectDatabase) Keys

                                                    func (db *ObjectDatabase) Keys() ([][]byte, error)

                                                    func (*ObjectDatabase) Last

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

                                                    func (*ObjectDatabase) MemCopy

                                                    func (db *ObjectDatabase) MemCopy() *ObjectDatabase

                                                    func (*ObjectDatabase) MultiPut

                                                    func (db *ObjectDatabase) MultiPut(tuples ...[]byte) (uint64, error)

                                                      MultiPut - requirements: input must be sorted and without duplicates

                                                      func (*ObjectDatabase) MultiWalk

                                                      func (db *ObjectDatabase) MultiWalk(bucket string, startkeys [][]byte, fixedbits []int, walker func(int, []byte, []byte) error) error

                                                      func (*ObjectDatabase) NewBatch

                                                      func (db *ObjectDatabase) NewBatch() DbWithPendingMutations

                                                      func (*ObjectDatabase) Put

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

                                                        Put inserts or updates a single entry.

                                                        func (*ObjectDatabase) TruncateAncients

                                                        func (db *ObjectDatabase) TruncateAncients(items uint64) error

                                                          TruncateAncients returns an error as we don't have a backing chain freezer.

                                                          func (*ObjectDatabase) Walk

                                                          func (db *ObjectDatabase) Walk(bucket string, startkey []byte, fixedbits int, walker func(k, v []byte) (bool, error)) error

                                                          type Putter

                                                          type Putter interface {
                                                          	// Put inserts or updates a single entry.
                                                          	Put(bucket string, key, value []byte) error
                                                          }

                                                            Putter wraps the database write operations.

                                                            type RWCounterDecorator

                                                            type RWCounterDecorator struct {
                                                            	Database
                                                            	DBCounterStats
                                                            }

                                                            func NewRWDecorator

                                                            func NewRWDecorator(db Database) *RWCounterDecorator

                                                            func (*RWCounterDecorator) Delete

                                                            func (d *RWCounterDecorator) Delete(bucket string, key []byte) error

                                                            func (*RWCounterDecorator) Get

                                                            func (d *RWCounterDecorator) Get(bucket string, key []byte) ([]byte, error)

                                                            func (*RWCounterDecorator) Has

                                                            func (d *RWCounterDecorator) Has(bucket string, key []byte) (bool, error)

                                                            func (*RWCounterDecorator) MultiPut

                                                            func (d *RWCounterDecorator) MultiPut(tuples ...[]byte) (uint64, error)

                                                            func (*RWCounterDecorator) MultiWalk

                                                            func (d *RWCounterDecorator) MultiWalk(bucket string, startkeys [][]byte, fixedbits []int, walker func(int, []byte, []byte) error) error

                                                            func (*RWCounterDecorator) NewBatch

                                                            func (*RWCounterDecorator) Put

                                                            func (d *RWCounterDecorator) Put(bucket string, key, value []byte) error

                                                            func (*RWCounterDecorator) Walk

                                                            func (d *RWCounterDecorator) Walk(bucket string, startkey []byte, fixedbits int, walker func([]byte, []byte) (bool, error)) error

                                                            type RemoteBackend

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

                                                            func (*RemoteBackend) AddLocal

                                                            func (back *RemoteBackend) AddLocal(signedTx []byte) ([]byte, error)

                                                            func (*RemoteBackend) Etherbase

                                                            func (back *RemoteBackend) Etherbase() (common.Address, error)

                                                            func (*RemoteBackend) NetVersion

                                                            func (back *RemoteBackend) NetVersion() (uint64, error)

                                                            type RemoteKV

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

                                                            func (*RemoteKV) AllBuckets

                                                            func (db *RemoteKV) AllBuckets() dbutils.BucketsCfg

                                                            func (*RemoteKV) Begin

                                                            func (db *RemoteKV) Begin(ctx context.Context, parent Tx, writable bool) (Tx, error)

                                                            func (*RemoteKV) Close

                                                            func (db *RemoteKV) Close()

                                                              Close All transactions must be closed before closing the database.

                                                              func (*RemoteKV) DiskSize

                                                              func (db *RemoteKV) DiskSize(ctx context.Context) (uint64, error)

                                                              func (*RemoteKV) Update

                                                              func (db *RemoteKV) Update(ctx context.Context, f func(tx Tx) error) (err error)

                                                              func (*RemoteKV) View

                                                              func (db *RemoteKV) View(ctx context.Context, f func(tx Tx) error) (err error)

                                                              type StorageMode

                                                              type StorageMode struct {
                                                              	History  bool
                                                              	Receipts bool
                                                              	TxIndex  bool
                                                              }

                                                              func GetStorageModeFromDB

                                                              func GetStorageModeFromDB(db Database) (StorageMode, error)

                                                              func StorageModeFromString

                                                              func StorageModeFromString(flags string) (StorageMode, error)

                                                              func (StorageMode) ToString

                                                              func (m StorageMode) ToString() string

                                                              type Tx

                                                              type Tx interface {
                                                              	Cursor(bucket string) Cursor
                                                              	NoValuesCursor(bucket string) NoValuesCursor
                                                              	Get(bucket string, key []byte) (val []byte, err error)
                                                              
                                                              	Commit(ctx context.Context) error
                                                              	Rollback()
                                                              	BucketSize(name string) (uint64, error)
                                                              }

                                                              type TxDb

                                                              type TxDb struct {
                                                              	ParentTx Tx
                                                              	// 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, call IdealBatchSize is unnecessary Walk and MultiWalk methods - work outside of Tx object yet, will implement it later

                                                                func NewTxDbWithoutTransaction

                                                                func NewTxDbWithoutTransaction(db Database) *TxDb

                                                                  NewTxDbWithoutTransaction creates TxDb object without opening transaction, such TxDb not usable before .Begin() call on it It allows inject TxDb object into class hierarchy, but open write transaction later

                                                                  func (*TxDb) Ancients

                                                                  func (m *TxDb) Ancients() (uint64, error)

                                                                    [TURBO-GETH] Freezer support (not implemented yet) Ancients returns an error as we don't have a backing chain freezer.

                                                                    func (*TxDb) Append

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

                                                                    func (*TxDb) BatchSize

                                                                    func (m *TxDb) BatchSize() int

                                                                    func (*TxDb) Begin

                                                                    func (m *TxDb) Begin() (DbWithPendingMutations, error)

                                                                    func (*TxDb) Close

                                                                    func (m *TxDb) Close()

                                                                    func (*TxDb) Commit

                                                                    func (m *TxDb) Commit() (uint64, error)

                                                                    func (*TxDb) CommitAndBegin

                                                                    func (m *TxDb) CommitAndBegin() error

                                                                    func (*TxDb) Delete

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

                                                                    func (*TxDb) DiskSize

                                                                    func (m *TxDb) DiskSize(ctx context.Context) (common.StorageSize, error)

                                                                    func (*TxDb) Get

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

                                                                    func (*TxDb) GetIndexChunk

                                                                    func (m *TxDb) GetIndexChunk(bucket string, key []byte, timestamp uint64) ([]byte, error)

                                                                    func (*TxDb) Has

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

                                                                    func (*TxDb) IdealBatchSize

                                                                    func (m *TxDb) IdealBatchSize() int

                                                                      IdealBatchSize defines the size of the data batches should ideally add in one write.

                                                                      func (*TxDb) KV

                                                                      func (m *TxDb) KV() KV

                                                                      func (*TxDb) Keys

                                                                      func (m *TxDb) Keys() ([][]byte, error)

                                                                      func (*TxDb) Last

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

                                                                        Can only be called from the worker thread

                                                                        func (*TxDb) MultiPut

                                                                        func (m *TxDb) MultiPut(tuples ...[]byte) (uint64, error)

                                                                        func (*TxDb) MultiWalk

                                                                        func (m *TxDb) MultiWalk(bucket string, startkeys [][]byte, fixedbits []int, walker func(int, []byte, []byte) error) error

                                                                        func (*TxDb) NewBatch

                                                                        func (m *TxDb) NewBatch() DbWithPendingMutations

                                                                        func (*TxDb) Put

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

                                                                        func (*TxDb) Rollback

                                                                        func (m *TxDb) Rollback()

                                                                        func (*TxDb) TruncateAncients

                                                                        func (m *TxDb) TruncateAncients(items uint64) error

                                                                          TruncateAncients returns an error as we don't have a backing chain freezer.

                                                                          func (*TxDb) Tx

                                                                          func (m *TxDb) Tx() Tx

                                                                          func (*TxDb) Walk

                                                                          func (m *TxDb) Walk(bucket string, startkey []byte, fixedbits int, walker func([]byte, []byte) (bool, error)) error

                                                                          Directories

                                                                          Path Synopsis
                                                                          Code generated by go generate; DO NOT EDIT.
                                                                          Code generated by go generate; DO NOT EDIT.