Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Initialise the database. Init should be called once the database object // is created. Init() error // InsertTx inserts the transaction into the database. InsertTx(tx tx.Tx) error // Tx gets the details of the transaction with the given hash. It returns an // `sql.ErrNoRows` if the transaction cannot be found. Tx(hash id.Hash) (tx.Tx, error) // Txs returns transactions with the given pagination options. Txs(offset, limit int, latest bool) ([]tx.Tx, error) // Txs returns transactions with the given pagination options. TxsByTxid(id pack.Bytes) ([]tx.Tx, error) // PendingTxs returns all pending transactions in the database which are not // expired. PendingTxs(expiry time.Duration) ([]tx.Tx, error) // TxStatus returns the current status of the transaction with the given // hash. TxStatus(hash id.Hash) (TxStatus, error) // UpdateStatus updates the status of the given transaction. The status // cannot be updated to a previous status. UpdateStatus(hash id.Hash, status TxStatus) error // Prune deletes transactions which have expired. Prune(expiry time.Duration) error // InsertGateway inserts the gateway into the database. InsertGateway(address string, tx tx.Tx) error // Gateway gets the details of the gateway with the given gateway address. It returns an // `sql.ErrNoRows` if the gateway cannot be found. Gateway(address string) (tx.Tx, error) // Gateways returns gateways with the given pagination options. Gateways(offset, limit int) ([]tx.Tx, error) // GatewayCount returns the number of gateways persisted GatewayCount() (int, error) // GatewayCount returns the number of gateways persisted MaxGatewayCount() int }
DB is a storage adapter (built on top of a SQL database) that stores all transaction details.
type GatewayStatus ¶
type GatewayStatus uint8
const ( GatewayStatusNil GatewayStatus = iota GatewayStatusEmpty GatewayStatusUsed )
Click to show internal directories.
Click to hide internal directories.