Documentation ¶
Index ¶
- type Batch
- type Iterator
- type Pebble
- func (s *Pebble) BlockIterator(fromBlockNum, toBlockNum uint64) (Iterator[*types.Block], error)
- func (s *Pebble) Close() error
- func (s *Pebble) GetBlock(blockNum uint64) (*types.Block, error)
- func (s *Pebble) GetLatestHeight() (uint64, error)
- func (s *Pebble) GetTx(blockNum uint64, index uint32) (*types.TxResult, error)
- func (s *Pebble) GetTxByHash(txHash string) (*types.TxResult, error)
- func (s *Pebble) TxIterator(fromBlockNum, toBlockNum uint64, fromTxIndex, toTxIndex uint32) (Iterator[*types.TxResult], error)
- func (s *Pebble) WriteBatch() Batch
- type PebbleBatch
- type PebbleBlockIter
- type PebbleTxIter
- type Reader
- type Storage
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface { // SetLatestHeight saves the latest block height to the storage SetLatestHeight(uint64) error // SetBlock saves the block to the permanent storage SetBlock(block *types.Block) error // SetTx saves the transaction to the permanent storage SetTx(tx *types.TxResult) error // Commit stores all the provided info on the storage and make // it available for other storage readers Commit() error // Rollback rollbacks the operation not persisting the provided changes Rollback() error }
type Pebble ¶
type Pebble struct {
// contains filtered or unexported fields
}
Pebble is the instance of an embedded storage
func (*Pebble) BlockIterator ¶
func (*Pebble) GetLatestHeight ¶
GetLatestHeight fetches the latest saved height from storage
func (*Pebble) TxIterator ¶
func (*Pebble) WriteBatch ¶
type PebbleBatch ¶
type PebbleBatch struct {
// contains filtered or unexported fields
}
func (*PebbleBatch) Commit ¶
func (b *PebbleBatch) Commit() error
func (*PebbleBatch) Rollback ¶
func (b *PebbleBatch) Rollback() error
Rollback closes the pebble batch without persisting any data. error output is always nil.
func (*PebbleBatch) SetLatestHeight ¶
func (b *PebbleBatch) SetLatestHeight(h uint64) error
type PebbleBlockIter ¶
type PebbleBlockIter struct {
// contains filtered or unexported fields
}
func (*PebbleBlockIter) Close ¶
func (pi *PebbleBlockIter) Close() error
func (*PebbleBlockIter) Error ¶
func (pi *PebbleBlockIter) Error() error
func (*PebbleBlockIter) Next ¶
func (pi *PebbleBlockIter) Next() bool
type PebbleTxIter ¶
type PebbleTxIter struct {
// contains filtered or unexported fields
}
func (*PebbleTxIter) Close ¶
func (pi *PebbleTxIter) Close() error
func (*PebbleTxIter) Error ¶
func (pi *PebbleTxIter) Error() error
func (*PebbleTxIter) Next ¶
func (pi *PebbleTxIter) Next() bool
type Reader ¶
type Reader interface { io.Closer // GetLatestHeight returns the latest block height from the storage GetLatestHeight() (uint64, error) // GetBlock fetches the block by its number GetBlock(uint64) (*types.Block, error) // GetTx fetches the tx using the block height and the transaction index GetTx(blockNum uint64, index uint32) (*types.TxResult, error) // GetTxByHash fetches the tx using the transaction hash GetTxByHash(txHash string) (*types.TxResult, error) // BlockIterator iterates over Blocks, limiting the results to be between the provided block numbers BlockIterator(fromBlockNum, toBlockNum uint64) (Iterator[*types.Block], error) // TxIterator iterates over transactions, limiting the results to be between the provided block numbers // and transaction indexes TxIterator(fromBlockNum, toBlockNum uint64, fromTxIndex, toTxIndex uint32) (Iterator[*types.TxResult], error) }
Reader defines the transaction storage interface for read methods
Click to show internal directories.
Click to hide internal directories.