db

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package db implements the data store

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNonceForChain = errors.New("no nonce exists for this chain")

ErrNoNonceForChain indicates that no nonces have been saved for the chain yet.

View Source
var ErrNoNonceForDomain = errors.New("no nonce exists for this domain")

ErrNoNonceForDomain indicates there is no nonce for a domain.

View Source
var ErrNoStoredBlockForChain = errors.New("no block exists for this chain")

ErrNoStoredBlockForChain indicates there are no blocks stored for this domain.

View Source
var ErrNotFound = errors.New("record not found")

ErrNotFound is a not found record standardized across db drivers.

Functions

This section is empty.

Types

type EthTxFilter added in v0.0.9

type EthTxFilter struct {
	TxHash      string
	ChainID     uint32
	BlockNumber uint64
}

EthTxFilter is a filter to use when querying the database for eth transactions.

type EventDB

type EventDB interface {
	EventDBWriter
	EventDBReader
}

EventDB stores events.

type EventDBReader added in v0.0.9

type EventDBReader interface {
	// RetrieveLogsWithFilter retrieves all logs that match a filter.
	RetrieveLogsWithFilter(ctx context.Context, logFilter LogFilter) (logs []*types.Log, err error)
	// RetrieveLogsInRange retrieves all logs that match an inputted filter, and are within a range.
	RetrieveLogsInRange(ctx context.Context, logFilter LogFilter, startBlock, endBlock uint64) (logs []*types.Log, err error)
	// RetrieveReceiptsInRange retrieves receipts in a range.
	RetrieveReceiptsInRange(ctx context.Context, receiptFilter ReceiptFilter, startBlock, endBlock uint64) (receipts []types.Receipt, err error)
	// RetrieveReceiptsWithFilter retrieves receipts with a filter.
	RetrieveReceiptsWithFilter(ctx context.Context, receiptFilter ReceiptFilter) (receipts []types.Receipt, err error)
	// RetrieveEthTxsWithFilter retrieves eth transactions with a filter.
	RetrieveEthTxsWithFilter(ctx context.Context, ethTxFilter EthTxFilter) ([]types.Transaction, error)
	// RetrieveEthTxsInRange retrieves eth transactions in a range.
	RetrieveEthTxsInRange(ctx context.Context, ethTxFilter EthTxFilter, startBlock, endBlock uint64) ([]types.Transaction, error)
	// RetrieveLastIndexed retrieves the last indexed for a contract address
	RetrieveLastIndexed(ctx context.Context, contractAddress common.Address, chainID uint32) (uint64, error)
}

EventDBReader is an interface for reading events from a database.

type EventDBWriter added in v0.0.9

type EventDBWriter interface {
	// StoreLog stores a log
	StoreLog(ctx context.Context, log types.Log, chainID uint32) error
	// StoreReceipt stores a receipt
	StoreReceipt(ctx context.Context, receipt types.Receipt, chainID uint32) error
	// StoreEthTx stores a processed transaction
	StoreEthTx(ctx context.Context, tx *types.Transaction, chainID uint32, blockNumber uint64) error
	// StoreLastIndexed stores the last indexed for a contract address
	StoreLastIndexed(ctx context.Context, contractAddress common.Address, chainID uint32, blockNumber uint64) error
}

EventDBWriter is an interface for writing events to a database.

type LogFilter added in v0.0.9

type LogFilter struct {
	ContractAddress string
	ChainID         uint32
	BlockNumber     uint64
	TxHash          string
	TxIndex         uint64
	BlockHash       string
	Index           uint64
}

LogFilter is a filter to use when querying the database for logs.

type ReceiptFilter added in v0.0.9

type ReceiptFilter struct {
	ChainID          uint32
	TxHash           string
	ContractAddress  string
	BlockHash        string
	BlockNumber      uint64
	TransactionIndex uint64
}

ReceiptFilter is a filter to use when querying the database for receipts.

Directories

Path Synopsis
datastore
sql
Package sql accesses a db
Package sql accesses a db
sql/base
Package base contains the base sql implementation
Package base contains the base sql implementation
sql/mysql
Package mysql implements the mysql package
Package mysql implements the mysql package
sql/sqlite
Package sqlite implements the sqlite package
Package sqlite implements the sqlite package

Jump to

Keyboard shortcuts

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