Documentation ¶
Index ¶
- func AddBatch(dbtx *dbTransaction, statements *SQLStatements, batch *common.ExtBatch) error
- func AddBlock(dbtx *dbTransaction, statements *SQLStatements, b *types.Header, ...) error
- func AddRollup(dbtx *dbTransaction, statements *SQLStatements, rollup *common.ExtRollup, ...) error
- func GetBatchByHash(db HostDB, hash common.L2BatchHash) (*common.ExtBatch, error)
- func GetBatchByHeight(db HostDB, height *big.Int) (*common.PublicBatch, error)
- func GetBatchBySequenceNumber(db HostDB, seqNo uint64) (*common.ExtBatch, error)
- func GetBatchByTx(db HostDB, txHash gethcommon.Hash) (*common.ExtBatch, error)
- func GetBatchHashByNumber(db HostDB, number *big.Int) (*gethcommon.Hash, error)
- func GetBatchHeader(db HostDB, hash gethcommon.Hash) (*common.BatchHeader, error)
- func GetBatchHeaderByHeight(db HostDB, height *big.Int) (*common.BatchHeader, error)
- func GetBatchListing(db HostDB, pagination *common.QueryPagination) (*common.BatchListingResponse, error)
- func GetBatchListingDeprecated(db HostDB, pagination *common.QueryPagination) (*common.BatchListingResponseDeprecated, error)
- func GetBatchNumber(db HostDB, txHash gethcommon.Hash) (*big.Int, error)
- func GetBatchTransactions(db HostDB, batchHash gethcommon.Hash) (*common.TransactionListingResponse, error)
- func GetBatchTxHashes(db HostDB, batchHash gethcommon.Hash) ([]gethcommon.Hash, error)
- func GetBlockListing(db HostDB, pagination *common.QueryPagination) (*common.BlockListingResponse, error)
- func GetCurrentHeadBatch(db HostDB) (*common.PublicBatch, error)
- func GetExtRollup(db HostDB, hash gethcommon.Hash) (*common.ExtRollup, error)
- func GetHeadBatchHeader(db HostDB) (*common.BatchHeader, error)
- func GetLatestBatch(db HostDB) (*common.BatchHeader, error)
- func GetLatestRollup(db HostDB) (*common.RollupHeader, error)
- func GetPublicBatch(db HostDB, hash common.L2BatchHash) (*common.PublicBatch, error)
- func GetPublicBatchBySequenceNumber(db HostDB, seqNo uint64) (*common.PublicBatch, error)
- func GetRollupBatches(db HostDB, rollupHash gethcommon.Hash) (*common.BatchListingResponse, error)
- func GetRollupByHash(db HostDB, rollupHash gethcommon.Hash) (*common.PublicRollup, error)
- func GetRollupBySeqNo(db HostDB, seqNo uint64) (*common.PublicRollup, error)
- func GetRollupHeader(db HostDB, hash gethcommon.Hash) (*common.RollupHeader, error)
- func GetRollupHeaderByBlock(db HostDB, blockHash gethcommon.Hash) (*common.RollupHeader, error)
- func GetRollupListing(db HostDB, pagination *common.QueryPagination) (*common.RollupListingResponse, error)
- func GetTotalTxCount(db HostDB) (*big.Int, error)
- func GetTotalTxsQuery(db HostDB) (*big.Int, error)
- func GetTransaction(db HostDB, hash gethcommon.Hash) (*common.PublicTransaction, error)
- func GetTransactionListing(db HostDB, pagination *common.QueryPagination) (*common.TransactionListingResponse, error)
- func GetTxsBySequenceNumber(db HostDB, seqNo uint64) ([]common.TxHash, error)
- type HostDB
- type SQLStatements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBatch ¶
func AddBatch(dbtx *dbTransaction, statements *SQLStatements, batch *common.ExtBatch) error
AddBatch adds a batch and its header to the DB
func AddBlock ¶
func AddBlock(dbtx *dbTransaction, statements *SQLStatements, b *types.Header, rollupHash common.L2RollupHash) error
AddBlock stores a block header with the given rollupHash it contains in the host DB
func AddRollup ¶
func AddRollup(dbtx *dbTransaction, statements *SQLStatements, rollup *common.ExtRollup, metadata *common.PublicRollupMetadata, block *common.L1Block) error
AddRollup adds a rollup to the DB
func GetBatchByHash ¶
GetBatchByHash returns the batch with the given hash.
func GetBatchByHeight ¶
GetBatchByHeight returns the batch header given the height
func GetBatchBySequenceNumber ¶
GetBatchBySequenceNumber returns the ext batch for a given sequence number.
func GetBatchByTx ¶
GetBatchByTx returns the batch with the given hash.
func GetBatchHashByNumber ¶
GetBatchHashByNumber returns the hash of a batch given its number.
func GetBatchHeader ¶
func GetBatchHeader(db HostDB, hash gethcommon.Hash) (*common.BatchHeader, error)
GetBatchHeader returns the batch header given the hash.
func GetBatchHeaderByHeight ¶ added in v0.24.1
GetBatchHeaderByHeight returns the batch header given the height
func GetBatchListing ¶
func GetBatchListing(db HostDB, pagination *common.QueryPagination) (*common.BatchListingResponse, error)
GetBatchListing returns latest batches given a pagination. For example, page 0, size 10 will return the latest 10 batches.
func GetBatchListingDeprecated ¶
func GetBatchListingDeprecated(db HostDB, pagination *common.QueryPagination) (*common.BatchListingResponseDeprecated, error)
GetBatchListingDeprecated returns latest batches given a pagination. For example, page 0, size 10 will return the latest 10 batches.
func GetBatchNumber ¶
GetBatchNumber returns the height of the batch containing the given transaction hash.
func GetBatchTransactions ¶ added in v0.24.1
func GetBatchTransactions(db HostDB, batchHash gethcommon.Hash) (*common.TransactionListingResponse, error)
GetBatchTransactions returns the TransactionListingResponse for a given batch hash
func GetBatchTxHashes ¶ added in v0.24.1
func GetBatchTxHashes(db HostDB, batchHash gethcommon.Hash) ([]gethcommon.Hash, error)
GetBatchTxHashes returns the transaction hashes of the batch with the given hash.
func GetBlockListing ¶
func GetBlockListing(db HostDB, pagination *common.QueryPagination) (*common.BlockListingResponse, error)
GetBlockListing returns a paginated list of blocks in descending order against the order they were added
func GetCurrentHeadBatch ¶
func GetCurrentHeadBatch(db HostDB) (*common.PublicBatch, error)
GetCurrentHeadBatch retrieves the current head batch with the largest sequence number (or height).
func GetExtRollup ¶
func GetHeadBatchHeader ¶
func GetHeadBatchHeader(db HostDB) (*common.BatchHeader, error)
GetHeadBatchHeader returns the latest batch header.
func GetLatestBatch ¶
func GetLatestBatch(db HostDB) (*common.BatchHeader, error)
GetLatestBatch returns the head batch header
func GetLatestRollup ¶
func GetLatestRollup(db HostDB) (*common.RollupHeader, error)
GetLatestRollup returns the latest rollup ordered by timestamp
func GetPublicBatch ¶
func GetPublicBatch(db HostDB, hash common.L2BatchHash) (*common.PublicBatch, error)
GetPublicBatch returns the batch with the given hash.
func GetPublicBatchBySequenceNumber ¶
func GetPublicBatchBySequenceNumber(db HostDB, seqNo uint64) (*common.PublicBatch, error)
GetPublicBatchBySequenceNumber returns the batch with the given sequence number.
func GetRollupBatches ¶ added in v0.24.1
func GetRollupBatches(db HostDB, rollupHash gethcommon.Hash) (*common.BatchListingResponse, error)
func GetRollupByHash ¶ added in v0.24.1
func GetRollupByHash(db HostDB, rollupHash gethcommon.Hash) (*common.PublicRollup, error)
func GetRollupBySeqNo ¶ added in v0.24.1
func GetRollupBySeqNo(db HostDB, seqNo uint64) (*common.PublicRollup, error)
func GetRollupHeader ¶
func GetRollupHeader(db HostDB, hash gethcommon.Hash) (*common.RollupHeader, error)
GetRollupHeader returns the rollup with the given hash.
func GetRollupHeaderByBlock ¶
func GetRollupHeaderByBlock(db HostDB, blockHash gethcommon.Hash) (*common.RollupHeader, error)
GetRollupHeaderByBlock returns the rollup for the given block
func GetRollupListing ¶
func GetRollupListing(db HostDB, pagination *common.QueryPagination) (*common.RollupListingResponse, error)
GetRollupListing returns latest rollups given a pagination. For example, offset 1, size 10 will return the latest 11-20 rollups.
func GetTotalTxCount ¶
GetTotalTxCount returns value from the transaction count table
func GetTotalTxsQuery ¶ added in v0.24.1
GetTotalTxsQuery returns the count of the transactions table
func GetTransaction ¶ added in v0.24.1
func GetTransaction(db HostDB, hash gethcommon.Hash) (*common.PublicTransaction, error)
GetTransaction returns a transaction given its hash
func GetTransactionListing ¶ added in v0.24.1
func GetTransactionListing(db HostDB, pagination *common.QueryPagination) (*common.TransactionListingResponse, error)
GetTransactionListing returns a paginated list of transactions in descending order
Types ¶
type HostDB ¶
type HostDB interface { GetSQLDB() *sql.DB NewDBTransaction() (*dbTransaction, error) GetSQLStatement() *SQLStatements }
type SQLStatements ¶
type SQLStatements struct { InsertBatch string InsertTransactions string InsertTxCount string InsertRollup string InsertBlock string Pagination string Placeholder string }
SQLStatements struct holds SQL statements for a specific database type
func PostgresSQLStatements ¶
func PostgresSQLStatements() *SQLStatements
func SQLiteSQLStatements ¶
func SQLiteSQLStatements() *SQLStatements