Documentation ¶
Index ¶
- type PostgresPoolStorage
- func (p *PostgresPoolStorage) AddTx(ctx context.Context, tx pool.Transaction) error
- func (p *PostgresPoolStorage) CountTransactionsByStatus(ctx context.Context, status pool.TxStatus) (uint64, 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) DepositCountExists(ctx context.Context, depositCount uint64) (bool, error)
- func (p *PostgresPoolStorage) GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
- func (p *PostgresPoolStorage) GetGasPrice(ctx context.Context) (uint64, error)
- func (p *PostgresPoolStorage) GetNonWIPTxsByStatus(ctx context.Context, status pool.TxStatus, isClaims bool, limit uint64) ([]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, isClaims bool, ...) ([]*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, isClaims bool, 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) MinGasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
- func (p *PostgresPoolStorage) SetGasPrice(ctx context.Context, gasPrice uint64) error
- func (p *PostgresPoolStorage) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus, isWIP bool) error
- func (p *PostgresPoolStorage) UpdateTxWIPStatus(ctx context.Context, hash common.Hash, isWIP bool) error
- func (p *PostgresPoolStorage) UpdateTxsStatus(ctx context.Context, hashes []string, newStatus pool.TxStatus) 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) CountTransactionsByStatus ¶
func (p *PostgresPoolStorage) CountTransactionsByStatus(ctx context.Context, status pool.TxStatus) (uint64, error)
CountTransactionsByStatus get number of transactions accordingly to the provided status
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) DepositCountExists ¶
func (p *PostgresPoolStorage) DepositCountExists(ctx context.Context, depositCount uint64) (bool, error)
DepositCountExists checks if already exists a `pending` or `selected` transaction in the pool with the provided deposit count
func (*PostgresPoolStorage) GetAllAddressesBlocked ¶
GetAllAddressesBlocked get all addresses blocked
func (*PostgresPoolStorage) GetGasPrice ¶
func (p *PostgresPoolStorage) GetGasPrice(ctx context.Context) (uint64, error)
GetGasPrice returns the current gas price
func (*PostgresPoolStorage) GetNonWIPTxsByStatus ¶
func (p *PostgresPoolStorage) GetNonWIPTxsByStatus(ctx context.Context, status pool.TxStatus, isClaims bool, limit uint64) ([]pool.Transaction, error)
GetNonWIPTxsByStatus 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) 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, isClaims bool, 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, isClaims bool, 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) MinGasPriceSince ¶
func (p *PostgresPoolStorage) MinGasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
MinGasPriceSince returns the min gas price after given timestamp
func (*PostgresPoolStorage) SetGasPrice ¶
func (p *PostgresPoolStorage) SetGasPrice(ctx context.Context, gasPrice uint64) error
SetGasPrice allows an external component to define the gas price
func (*PostgresPoolStorage) UpdateTxStatus ¶
func (p *PostgresPoolStorage) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus, isWIP bool) 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, hashes []string, newStatus pool.TxStatus) error
UpdateTxsStatus updates transactions status accordingly to the provided status and hashes