Documentation ¶
Index ¶
- type PostgresPoolStorage
- func (p *PostgresPoolStorage) AddTx(ctx context.Context, tx pool.Transaction) error
- func (p *PostgresPoolStorage) CountTransactionsByFromAndStatus(ctx context.Context, from common.Address, status ...pool.TxStatus) (uint64, error)
- func (p *PostgresPoolStorage) CountTransactionsByStatus(ctx context.Context, status ...pool.TxStatus) (uint64, error)
- func (p *PostgresPoolStorage) DeleteFailedTransactionsOlderThan(ctx context.Context, date time.Time) error
- func (p *PostgresPoolStorage) DeleteGasPricesHistoryOlderThan(ctx context.Context, date time.Time) error
- func (p *PostgresPoolStorage) DeleteTransactionByHash(ctx context.Context, hash common.Hash) error
- func (p *PostgresPoolStorage) DeleteTransactionsByHashes(ctx context.Context, hashes []common.Hash) error
- func (p *PostgresPoolStorage) GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
- func (p *PostgresPoolStorage) GetGasPrices(ctx context.Context) (uint64, uint64, error)
- func (p *PostgresPoolStorage) GetNonWIPPendingTxs(ctx context.Context) ([]pool.Transaction, error)
- func (p *PostgresPoolStorage) GetNonce(ctx context.Context, address common.Address) (uint64, error)
- func (p *PostgresPoolStorage) GetPendingTxHashesSince(ctx context.Context, since time.Time) ([]common.Hash, error)
- func (p *PostgresPoolStorage) GetTxByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
- func (p *PostgresPoolStorage) GetTxFromAddressFromByHash(ctx context.Context, hash common.Hash) (common.Address, uint64, error)
- func (p *PostgresPoolStorage) GetTxZkCountersByHash(ctx context.Context, hash common.Hash) (*state.ZKCounters, error)
- func (p *PostgresPoolStorage) GetTxs(ctx context.Context, filterStatus pool.TxStatus, minGasPrice, limit uint64) ([]*pool.Transaction, error)
- func (p *PostgresPoolStorage) GetTxsByFromAndNonce(ctx context.Context, from common.Address, nonce uint64) ([]pool.Transaction, error)
- func (p *PostgresPoolStorage) GetTxsByStatus(ctx context.Context, status pool.TxStatus, limit uint64) ([]pool.Transaction, error)
- func (p *PostgresPoolStorage) IsTxPending(ctx context.Context, hash common.Hash) (bool, error)
- func (p *PostgresPoolStorage) MarkWIPTxsAsPending(ctx context.Context) error
- func (p *PostgresPoolStorage) MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
- func (p *PostgresPoolStorage) SetGasPrices(ctx context.Context, l2GasPrice, l1GasPrice uint64) error
- func (p *PostgresPoolStorage) UpdateTxStatus(ctx context.Context, updateInfo pool.TxStatusUpdateInfo) error
- func (p *PostgresPoolStorage) UpdateTxWIPStatus(ctx context.Context, hash common.Hash, isWIP bool) error
- func (p *PostgresPoolStorage) UpdateTxsStatus(ctx context.Context, updateInfos []pool.TxStatusUpdateInfo) error
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 ¶
func (p *PostgresPoolStorage) AddTx(ctx context.Context, tx pool.Transaction) error
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 ¶
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 ¶
GetAllAddressesBlocked get all addresses blocked
func (*PostgresPoolStorage) GetGasPrices ¶ added in v0.0.990
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 ¶
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) GetTxByHash ¶
func (p *PostgresPoolStorage) GetTxByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
GetTxByHash gets a transaction in the pool by its 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, 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 ¶
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