Documentation ¶
Index ¶
- Constants
- type Driver
- func (d *Driver) BlockContinuityCheck(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
- func (d *Driver) BlockTransactionCheck(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([]uint64, error)
- func (d *Driver) Flush() error
- func (d *Driver) GetBlockForTime(ctx context.Context, blx structs.BlockWithMeta, time time.Time) (out structs.Block, isBefore bool, err error)
- func (d *Driver) GetBlocksHeightsWithNumTx(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
- func (d *Driver) GetLatestBlock(ctx context.Context, blx structs.BlockWithMeta) (out structs.Block, err error)
- func (d *Driver) GetLatestTransaction(ctx context.Context, in structs.TransactionWithMeta) (out structs.Transaction, err error)
- func (d *Driver) GetTransactions(ctx context.Context, tsearch params.TransactionSearch) (txs []structs.Transaction, err error)
- func (d *Driver) GetTransactionsHeightsWithTxCount(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
- func (d *Driver) StoreBlock(bl structs.BlockWithMeta) error
- func (d *Driver) StoreTransaction(tx structs.TransactionWithMeta) error
- func (d *Driver) StoreTransactions(txs []structs.TransactionWithMeta) error
- type ValuesPool
Constants ¶
const GetBlockForTimeQuery = `` /* 193-byte string literal not displayed */
const NumberOfTxFields = 21
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is postgres database driver implementation
func (*Driver) BlockContinuityCheck ¶
func (d *Driver) BlockContinuityCheck(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
BlockContinuityCheck check data consistency between given ranges in network / chain
func (*Driver) BlockTransactionCheck ¶
func (d *Driver) BlockTransactionCheck(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([]uint64, error)
BlockTransactionCheck check if every block has correct, corresponding number of transactions
func (*Driver) GetBlockForTime ¶ added in v0.1.2
func (d *Driver) GetBlockForTime(ctx context.Context, blx structs.BlockWithMeta, time time.Time) (out structs.Block, isBefore bool, err error)
GetBlockForTime returns first block that comes on or after given time. If no such block exists, returns closest block that comes before given time.
func (*Driver) GetBlocksHeightsWithNumTx ¶ added in v0.0.2
func (d *Driver) GetBlocksHeightsWithNumTx(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
GetBlocksHeightsWithNumTx gets heights and number of transactions for each block in range
func (*Driver) GetLatestBlock ¶
func (d *Driver) GetLatestBlock(ctx context.Context, blx structs.BlockWithMeta) (out structs.Block, err error)
GetLatestBlock gets latest block
func (*Driver) GetLatestTransaction ¶
func (d *Driver) GetLatestTransaction(ctx context.Context, in structs.TransactionWithMeta) (out structs.Transaction, err error)
GetLatestTransaction gets latest transaction from database
func (*Driver) GetTransactions ¶
func (d *Driver) GetTransactions(ctx context.Context, tsearch params.TransactionSearch) (txs []structs.Transaction, err error)
GetTransactions gets transactions based on given criteria the order is forced to be time DESC
func (*Driver) GetTransactionsHeightsWithTxCount ¶ added in v0.0.2
func (d *Driver) GetTransactionsHeightsWithTxCount(ctx context.Context, blx structs.BlockWithMeta, startHeight, endHeight uint64) ([][2]uint64, error)
GetTransactionsHeightsWithTxCount gets the count of transaction groupped by heights
func (*Driver) StoreBlock ¶
func (d *Driver) StoreBlock(bl structs.BlockWithMeta) error
StoreBlock appends data to buffer
func (*Driver) StoreTransaction ¶
func (d *Driver) StoreTransaction(tx structs.TransactionWithMeta) error
StoreTransaction adds transaction to storage buffer
func (*Driver) StoreTransactions ¶
func (d *Driver) StoreTransactions(txs []structs.TransactionWithMeta) error
StoreTransactions adds transactions to storage buffer
type ValuesPool ¶
ValuesPool is Pool of fixed size slices of interface{}
func NewValuesPool ¶
func NewValuesPool(count, fields, size int) *ValuesPool
NewValuesPool is ValuesPool constructor
func (*ValuesPool) Put ¶
func (vp *ValuesPool) Put(val []interface{})
Put back to the pool or discard