pgpoolstorage

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresPoolStorage

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

PostgresPoolStorage is an implementation of the Pool interface that uses a postgres database to store the data

func NewPostgresPoolStorage

func NewPostgresPoolStorage(cfg db.Config) (*PostgresPoolStorage, error)

NewPostgresPoolStorage creates and initializes an instance of PostgresPoolStorage

func (*PostgresPoolStorage) AddTx

AddTx adds a transaction to the pool table with the provided status

func (*PostgresPoolStorage) CountTransactionsByFromAndStatus added in v0.0.990

func (p *PostgresPoolStorage) CountTransactionsByFromAndStatus(ctx context.Context, from common.Address, status ...pool.TxStatus) (uint64, error)

CountTransactionsByFromAndStatus get number of transactions accordingly to the from address and provided statuses

func (*PostgresPoolStorage) CountTransactionsByStatus

func (p *PostgresPoolStorage) CountTransactionsByStatus(ctx context.Context, status ...pool.TxStatus) (uint64, error)

CountTransactionsByStatus get number of transactions accordingly to the provided statuses

func (*PostgresPoolStorage) DeleteFailedTransactionsOlderThan added in v0.4.0

func (p *PostgresPoolStorage) DeleteFailedTransactionsOlderThan(ctx context.Context, date time.Time) error

DeleteFailedTransactionsOlderThan deletes all failed transactions older than the given date

func (*PostgresPoolStorage) DeleteGasPricesHistoryOlderThan added in v0.0.990

func (p *PostgresPoolStorage) DeleteGasPricesHistoryOlderThan(ctx context.Context, date time.Time) error

DeleteGasPricesHistoryOlderThan deletes all gas prices older than the given date except the last one

func (*PostgresPoolStorage) DeleteTransactionByHash

func (p *PostgresPoolStorage) DeleteTransactionByHash(ctx context.Context, hash common.Hash) error

DeleteTransactionByHash deletes tx by its hash

func (*PostgresPoolStorage) DeleteTransactionsByHashes

func (p *PostgresPoolStorage) DeleteTransactionsByHashes(ctx context.Context, hashes []common.Hash) error

DeleteTransactionsByHashes deletes txs by their hashes

func (*PostgresPoolStorage) GetAllAddressesBlocked

func (p *PostgresPoolStorage) GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)

GetAllAddressesBlocked get all addresses blocked

func (*PostgresPoolStorage) GetEarliestProcessedTx added in v0.4.7

func (p *PostgresPoolStorage) GetEarliestProcessedTx(ctx context.Context) (common.Hash, error)

GetEarliestProcessedTx gets the earliest processed tx from the pool. Mainly used for cleanup

func (*PostgresPoolStorage) GetGasPrices added in v0.0.990

func (p *PostgresPoolStorage) GetGasPrices(ctx context.Context) (uint64, uint64, error)

GetGasPrices returns the latest l2 and l1 gas prices

func (*PostgresPoolStorage) GetNonWIPPendingTxs added in v0.0.990

func (p *PostgresPoolStorage) GetNonWIPPendingTxs(ctx context.Context) ([]pool.Transaction, error)

GetNonWIPPendingTxs returns an array of transactions

func (*PostgresPoolStorage) GetNonce

func (p *PostgresPoolStorage) GetNonce(ctx context.Context, address common.Address) (uint64, error)

GetNonce gets the nonce to the provided address accordingly to the txs in the pool

func (*PostgresPoolStorage) GetPendingTxHashesSince

func (p *PostgresPoolStorage) GetPendingTxHashesSince(ctx context.Context, since time.Time) ([]common.Hash, error)

GetPendingTxHashesSince returns the pending tx since the given time.

func (*PostgresPoolStorage) GetTransactionByHash added in v0.5.0

func (p *PostgresPoolStorage) GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)

GetTransactionByHash gets a transaction in the pool by its hash

func (*PostgresPoolStorage) GetTransactionByL2Hash added in v0.5.0

func (p *PostgresPoolStorage) GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)

GetTransactionByL2Hash gets a transaction in the pool by its l2 hash

func (*PostgresPoolStorage) GetTxFromAddressFromByHash

func (p *PostgresPoolStorage) GetTxFromAddressFromByHash(ctx context.Context, hash common.Hash) (common.Address, uint64, error)

GetTxFromAddressFromByHash gets tx from address by hash

func (*PostgresPoolStorage) GetTxZkCountersByHash

func (p *PostgresPoolStorage) GetTxZkCountersByHash(ctx context.Context, hash common.Hash) (*state.ZKCounters, *state.ZKCounters, error)

GetTxZkCountersByHash gets a transaction zkcounters by its hash

func (*PostgresPoolStorage) GetTxs

func (p *PostgresPoolStorage) GetTxs(ctx context.Context, filterStatus pool.TxStatus, minGasPrice, limit uint64) ([]*pool.Transaction, error)

GetTxs gets txs with the lowest nonce

func (*PostgresPoolStorage) GetTxsByFromAndNonce

func (p *PostgresPoolStorage) GetTxsByFromAndNonce(ctx context.Context, from common.Address, nonce uint64) ([]pool.Transaction, error)

GetTxsByFromAndNonce get all the transactions from the pool with the same from and nonce

func (*PostgresPoolStorage) GetTxsByStatus

func (p *PostgresPoolStorage) GetTxsByStatus(ctx context.Context, status pool.TxStatus, limit uint64) ([]pool.Transaction, error)

GetTxsByStatus returns an array of transactions filtered by status limit parameter is used to limit amount txs from the db, if limit = 0, then there is no limit

func (*PostgresPoolStorage) IsTxPending

func (p *PostgresPoolStorage) IsTxPending(ctx context.Context, hash common.Hash) (bool, error)

IsTxPending determines if the tx associated to the given hash is pending or not.

func (*PostgresPoolStorage) MarkWIPTxsAsPending

func (p *PostgresPoolStorage) MarkWIPTxsAsPending(ctx context.Context) error

MarkWIPTxsAsPending updates WIP status to non WIP

func (*PostgresPoolStorage) MinL2GasPriceSince added in v0.0.990

func (p *PostgresPoolStorage) MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)

MinL2GasPriceSince returns the min L2 gas price after given timestamp

func (*PostgresPoolStorage) SetGasPrices added in v0.0.990

func (p *PostgresPoolStorage) SetGasPrices(ctx context.Context, l2GasPrice, l1GasPrice uint64) error

SetGasPrices sets the latest l2 and l1 gas prices

func (*PostgresPoolStorage) UpdateTxStatus

func (p *PostgresPoolStorage) UpdateTxStatus(ctx context.Context, updateInfo pool.TxStatusUpdateInfo) error

UpdateTxStatus updates a transaction status accordingly to the provided status and hash

func (*PostgresPoolStorage) UpdateTxWIPStatus

func (p *PostgresPoolStorage) UpdateTxWIPStatus(ctx context.Context, hash common.Hash, isWIP bool) error

UpdateTxWIPStatus updates a transaction wip status accordingly to the provided WIP status and hash

func (*PostgresPoolStorage) UpdateTxsStatus

func (p *PostgresPoolStorage) UpdateTxsStatus(ctx context.Context, updateInfos []pool.TxStatusUpdateInfo) error

UpdateTxsStatus updates transactions status accordingly to the provided status and hashes

Jump to

Keyboard shortcuts

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