Documentation ¶
Index ¶
- Variables
- func NewMVCCComparer() *pebble.Comparer
- type Blocks
- func (b *Blocks) GetByHeight(height uint64) (*models.Block, error)
- func (b *Blocks) GetByID(ID common.Hash) (*models.Block, error)
- func (b *Blocks) GetCadenceHeight(evmHeight uint64) (uint64, error)
- func (b *Blocks) GetCadenceID(evmHeight uint64) (flow.Identifier, error)
- func (b *Blocks) GetHeightByID(ID common.Hash) (uint64, error)
- func (b *Blocks) InitHeights(cadenceHeight uint64, cadenceID flow.Identifier, batch *pebble.Batch) error
- func (b *Blocks) LatestCadenceHeight() (uint64, error)
- func (b *Blocks) LatestEVMHeight() (uint64, error)
- func (b *Blocks) SetLatestCadenceHeight(height uint64, batch *pebble.Batch) error
- func (b *Blocks) Store(cadenceHeight uint64, cadenceID flow.Identifier, block *models.Block, ...) error
- type GetAtHeightFunc
- type Receipts
- func (r *Receipts) BloomsForBlockRange(start, end uint64) ([]*models.BloomsHeight, error)
- func (r *Receipts) GetByBlockHeight(height uint64) ([]*models.Receipt, error)
- func (r *Receipts) GetByTransactionID(ID common.Hash) (*models.Receipt, error)
- func (r *Receipts) Store(receipts []*models.Receipt, batch *pebble.Batch) error
- type RegisterStorage
- func (r *RegisterStorage) Get(id flow.RegisterID, height uint64) (value flow.RegisterValue, err error)
- func (r *RegisterStorage) GetSnapshotAt(evmBlockHeight uint64) (types.BackendStorageSnapshot, error)
- func (r *RegisterStorage) Store(entries flow.RegisterEntries, height uint64, batch *pebble.Batch) error
- type Storage
- type StorageSnapshot
- type Traces
- type Transactions
Constants ¶
This section is empty.
Variables ¶
var ( // MinLookupKeyLen defines the minimum length for a valid lookup key // // Lookup keys use the following format: // [marker] [key] / [height] // Where: // - marker: 1 byte marking that this is a register key // - key: optional variable length field // - height: 8 bytes representing the block height (uint64) // - separator: '/' is used to separate variable length field // // Therefore the minimum key would be 2 bytes + # of bytes for height // [marker] / [height] MinLookupKeyLen = 2 + registers.HeightSuffixLen )
Functions ¶
func NewMVCCComparer ¶ added in v1.0.0
Types ¶
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
func (*Blocks) GetCadenceHeight ¶
func (*Blocks) GetCadenceID ¶ added in v0.16.0
func (*Blocks) GetHeightByID ¶ added in v0.7.0
func (*Blocks) InitHeights ¶ added in v0.2.0
func (b *Blocks) InitHeights(cadenceHeight uint64, cadenceID flow.Identifier, batch *pebble.Batch) error
InitHeights sets the Cadence height to zero as well as EVM heights. Used for empty database init.
func (*Blocks) LatestCadenceHeight ¶
func (*Blocks) LatestEVMHeight ¶
func (*Blocks) SetLatestCadenceHeight ¶ added in v0.2.0
type GetAtHeightFunc ¶ added in v1.0.0
type GetAtHeightFunc func(id flow.RegisterID, height uint64) (flow.RegisterValue, error)
type Receipts ¶
type Receipts struct {
// contains filtered or unexported fields
}
func NewReceipts ¶
func (*Receipts) BloomsForBlockRange ¶
func (r *Receipts) BloomsForBlockRange(start, end uint64) ([]*models.BloomsHeight, error)
func (*Receipts) GetByBlockHeight ¶
func (*Receipts) GetByTransactionID ¶
func (*Receipts) Store ¶
Store receipt in the index.
Storing receipt will create multiple indexes, each receipt has a transaction ID, and a block height. We create following mappings: - receipt transaction ID => block height bytes - receipt block height => list of encoded receipts (1+ per block) - receipt block height => list of bloom filters (1+ per block)
type RegisterStorage ¶ added in v1.0.0
type RegisterStorage struct {
// contains filtered or unexported fields
}
func NewRegisterStorage ¶ added in v1.0.0
func NewRegisterStorage( store *Storage, owner flow.Address, ) *RegisterStorage
NewRegisterStorage creates a new index instance at the provided height, all reads and writes of the registers will happen at that height. this is not concurrency safe.
The register store does verify that the owner supplied is the one that was used before, or that the heights are sequential. This should be done by the caller.
The RegisterStorage is modeled after `pebble.Registers` from `flow-go` but there are a few differences:
- The `flow-go` implementation creates its own independent batch when saving registers. The gateway needs to save the registers together with blocks and transaction so the batch is shared with that.
- The gateway does not need to store the owner address as all the registers are for the same owner.
- The gateway does not need pruning (yet) as the db is supposed to be much smaller.
- The owner and height checks are expected to be performed by the caller.
func (*RegisterStorage) Get ¶ added in v1.0.0
func (r *RegisterStorage) Get(id flow.RegisterID, height uint64) (value flow.RegisterValue, err error)
Get returns the register value for the given register ID at the given height. Get will check that the owner is the same as the one used to create the index.
func (*RegisterStorage) GetSnapshotAt ¶ added in v1.0.0
func (r *RegisterStorage) GetSnapshotAt(evmBlockHeight uint64) (types.BackendStorageSnapshot, error)
GetSnapshotAt returns a snapshot of the register index at the given block height. the snapshot has a cache. Nil values are cached.
func (*RegisterStorage) Store ¶ added in v1.0.0
func (r *RegisterStorage) Store(entries flow.RegisterEntries, height uint64, batch *pebble.Batch) error
Store stores the register entries for the given height to the given batch. The batch does need to be indexed.
Store will check that all the register entries are for the same owner.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
type StorageSnapshot ¶ added in v1.0.0
type StorageSnapshot struct {
// contains filtered or unexported fields
}
func NewStorageSnapshot ¶ added in v1.0.0
func NewStorageSnapshot(get GetAtHeightFunc, evmBlockHeight uint64) *StorageSnapshot
NewStorageSnapshot creates a new snapshot of the register index at the given block height. the snapshot has a cache. Nil values are cached. The snapshot is not concurrency-safe.
type Traces ¶ added in v0.16.0
type Traces struct {
// contains filtered or unexported fields
}
func (*Traces) GetTransaction ¶ added in v0.16.0
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
func NewTransactions ¶
func NewTransactions(store *Storage) *Transactions
func (*Transactions) Get ¶
func (t *Transactions) Get(ID common.Hash) (models.Transaction, error)
func (*Transactions) Store ¶
func (t *Transactions) Store(tx models.Transaction, batch *pebble.Batch) error