execdb

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance added in v0.3.6

type Balance struct {
	Address  types.Address
	Currency string
	Amount   decimal.Decimal
	From     time.Time
}

Balance holds information about a balance.

type BalanceFilter added in v0.3.6

type BalanceFilter struct {
	// Limit is the maximum number of balances to return.
	// If 0 then there is no limit.
	Limit uint32

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// Currency is the currency to fetch.
	// If nil then there is no currency filter
	Currency string

	// From is the timestamp of the earliest balance to fetch.
	// If nil then there is no earliest balance.
	From *time.Time

	// To is the timestamp of the latest balance to fetch.
	// If nil then there is no latest balance.
	To *time.Time

	// Holders are the holders of the balance.
	// If nil then no filter is applied.
	Holders [][]byte
}

BalanceFilter defines a filter for fetching balances. Filter elements are ANDed together. Results are always returned in ascending holder/timestamp/currency order.

type BalancesProvider added in v0.3.6

type BalancesProvider interface {
	// Balances returns balances matching the supplied filter.
	Balances(ctx context.Context, filter *BalanceFilter) ([]*Balance, error)
}

BalancesProvider defines functions to provide balance information.

type BalancesSetter added in v0.3.6

type BalancesSetter interface {
	Service
	// SetBalance sets a balance.
	SetBalance(ctx context.Context, balance *Balance) error

	// SetBalances sets multiple balances efficiently.
	SetBalances(ctx context.Context, balances []*Balance) error
}

BalancesSetter defines functions to create and update balances.

type Block

type Block struct {
	Height          uint32
	Hash            []byte
	BaseFee         uint64
	Difficulty      uint64
	ExtraData       []byte
	GasLimit        uint32
	GasUsed         uint32
	FeeRecipient    []byte
	ParentHash      []byte
	Size            uint32
	StateRoot       []byte
	Timestamp       time.Time
	TotalDifficulty *big.Int
	Issuance        *big.Int
}

Block holds information about a block.

type BlockFilter added in v0.3.1

type BlockFilter struct {
	// Limit is the maximum number of blocks to return.
	// If nil then there is no limit.
	Limit *uint32

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// From is the height of the earliest block to fetch.
	// If nil then there is no earliest block.
	From *uint32

	// TimestampTo is the height of the latest block to fetch.
	// If nil then there is no latest block.
	To *uint32

	// From is the timestamp of the earliest block to fetch.
	// If nil then there is no earliest block.
	TimestampFrom *time.Time

	// TimestampTo is the timestamp of the latest block to fetch.
	// If nil then there is no latest block.
	TimestampTo *time.Time

	// FeeRecipients are the fee recipients of the blocks.
	// If nil then there is no fee recipients filter.
	FeeRecipients *[][]byte
}

BlockFilter defines a filter for fetching blocks. Filter elements are ANDed together. Results are always returned in ascending block height order.

type BlockReward added in v0.4.1

type BlockReward struct {
	BlockHash   []byte
	BlockHeight uint32
	Fees        *uint256.Int
	Payments    *uint256.Int
}

BlockReward holds information about the reward paid to the fee recipient in a block.

type BlockRewardsSetter added in v0.4.1

type BlockRewardsSetter interface {
	Service

	// SetBlockRewards sets multiple block rewards efficiently.
	SetBlockRewards(ctx context.Context, rewards []*BlockReward) error
}

BlockRewardsSetter defines functions to create and update block rewards.

type BlocksProvider added in v0.3.1

type BlocksProvider interface {
	// Blocks returns blocks matching the supplied filter.
	Blocks(ctx context.Context, filter *BlockFilter) ([]*Block, error)
}

BlocksProvider defines functions to provide block information.

type BlocksSetter

type BlocksSetter interface {
	Service
	// SetBlock sets a block.
	SetBlock(ctx context.Context, block *Block) error

	// SetBlocks sets multiple blocks efficiently.
	SetBlocks(ctx context.Context, blocks []*Block) error
}

BlocksSetter defines functions to create and update blocks.

type Event

type Event struct {
	TransactionHash []byte
	BlockHeight     uint32
	Index           uint32 // aka LogIndex, index of the event in the block.
	Address         []byte
	Topics          [][]byte
	Data            []byte
}

Event holds information about a transaction event.

type EventFilter added in v0.1.1

type EventFilter struct {
	// Limit is the maximum number of events to return.
	// If nil then there is no limit.
	Limit *uint32

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// From is the height of the earliest block from which to fetch events.
	// If nil then there is no earliest block.
	From *uint32

	// To is the height of the latest block from which to fetch events.
	// If nil then there is no latest block.
	To *uint32

	// TransactionHash is the hash of the transaction that generated the event.
	// If nil then no filter is applied
	TransactionHash *[]byte

	// Address is the address of the contract that generated the event.
	// If nil then no filter is applied
	Address *[]byte
}

EventFilter defines a filter for fetching events. Filter elements are ANDed together. Results are always returned in ascending (block height, transaction index, event index) order.

type EventsProvider added in v0.1.1

type EventsProvider interface {
	// Events returns events matching the supplied filter.
	Events(ctx context.Context, filter *EventFilter) ([]*Event, error)
}

EventsProvider defines functions to provide event information.

type EventsSetter

type EventsSetter interface {
	Service

	// SetEvent sets an event.
	SetEvent(ctx context.Context, event *Event) error

	// SetEvents sets multiple events efficiently.
	SetEvents(ctx context.Context, events []*Event) error
}

EventsSetter defines functions to create and update events.

type Order

type Order uint8

Order is the order in which results should be fetched (N.B. fetched, not returned).

const (
	// OrderEarliest fetches earliest transactions first.
	OrderEarliest Order = iota
	// OrderLatest fetches latest transactions first.
	OrderLatest
)

type Service

type Service interface {
	// BeginTx begins a transaction.
	BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)

	// CommitTx commits a transaction.
	CommitTx(ctx context.Context) error

	// SetMetadata sets a metadata key to a JSON value.
	SetMetadata(ctx context.Context, key string, value []byte) error

	// Metadata obtains the JSON value from a metadata key.
	Metadata(ctx context.Context, key string) ([]byte, error)
}

Service defines a minimal exec database service.

type Transaction

type Transaction struct {
	AccessList           map[string][][]byte
	BlockHeight          uint32
	BlockHash            []byte
	ContractAddress      *[]byte
	Index                uint32
	Type                 uint64
	From                 []byte
	GasLimit             uint32
	GasPrice             uint64
	GasUsed              uint32
	Hash                 []byte
	Input                []byte
	MaxFeePerGas         *uint64
	MaxPriorityFeePerGas *uint64
	Nonce                uint64
	R                    *big.Int
	S                    *big.Int
	Status               uint32
	To                   *[]byte
	V                    *big.Int
	Value                *big.Int
}

Transaction holds information about a transaction.

type TransactionAccessListEntry added in v0.3.1

type TransactionAccessListEntry struct {
	TransactionHash []byte
	BlockHeight     uint32
	Address         []byte
	StorageKeys     [][]byte
}

TransactionAccessListEntry holds information about a transaction access list.

type TransactionBalanceChange

type TransactionBalanceChange struct {
	TransactionHash []byte
	BlockHeight     uint32
	Address         []byte
	Old             *big.Int
	New             *big.Int
}

TransactionBalanceChange holds information about a balance change as a result of a transaction.

type TransactionFilter

type TransactionFilter struct {
	// Limit is the maximum number of transactions to return.
	// If nil then there is no limit.
	Limit *uint32

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// From is the height of the earliest block from which to fetch transactions.
	// If nil then there is no earliest block.
	From *uint32

	// To is the height of the latest block from which to fetch transactions.
	// If nil then there is no latest block.
	To *uint32

	// Sender is the address of the sender field in the transaction.
	// If nil then no filter is applied
	Sender *[]byte

	// Recipient is the address of the recipient field in the transaction.
	// If nil then no filter is applied
	Recipient *[]byte
}

TransactionFilter defines a filter for fetching transactions. Filter elements are ANDed together. Results are always returned in ascending (block height, transaction index) order.

type TransactionStateDiff

type TransactionStateDiff struct {
	BalanceChanges []*TransactionBalanceChange
	StorageChanges []*TransactionStorageChange
}

TransactionStateDiff holds information about state differences as a result of a transaction.

type TransactionStateDiffsProvider added in v0.3.1

type TransactionStateDiffsProvider interface {
	// TransactionStateDiff returns transaction state diffs for the supplied hash.
	TransactionStateDiff(ctx context.Context, hash []byte) (*TransactionStateDiff, error)
}

TransactionStateDiffsProvider defines function to provide transaction state diff information.

type TransactionStateDiffsSetter

type TransactionStateDiffsSetter interface {
	Service
	// SetTransactionStateDiff sets a transaction's state differences.
	SetTransactionStateDiff(ctx context.Context, stateDiff *TransactionStateDiff) error

	// SetTransactionStateDiffs sets multiple transactions' state differences efficiently.
	SetTransactionStateDiffs(ctx context.Context, stateDiffs []*TransactionStateDiff) error
}

TransactionStateDiffsSetter defines functions to create and update state differences.

type TransactionStorageChange

type TransactionStorageChange struct {
	TransactionHash []byte
	BlockHeight     uint32
	Address         []byte
	StorageAddress  []byte
	Value           []byte
}

TransactionStorageChange holds information about a storage change as a result of a transaction.

type TransactionsProvider

type TransactionsProvider interface {
	// Transactions returns transactions matching the supplied filter.
	Transactions(ctx context.Context, filter *TransactionFilter) ([]*Transaction, error)

	// Transaction returns the transaction matching the supplied hash.
	Transaction(ctx context.Context, hash []byte) (*Transaction, error)
}

TransactionsProvider defines functions to provide transaction information.

type TransactionsSetter

type TransactionsSetter interface {
	Service

	// SetTransaction sets a transaction.
	SetTransaction(ctx context.Context, transaction *Transaction) error

	// SetTransactions sets multiple transactions efficiently.
	SetTransactions(ctx context.Context, transactions []*Transaction) error
}

TransactionsSetter defines functions to create and update transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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