Documentation
¶
Index ¶
- func Initialize(lpath string)
- type Conf
- type KVLedger
- func (l *KVLedger) Close()
- func (l *KVLedger) Commit() error
- func (l *KVLedger) GetBlockByHash(blockHash []byte) (*common.Block, error)
- func (l *KVLedger) GetBlockByNumber(blockNumber uint64) (*common.Block, error)
- func (l *KVLedger) GetBlockchainInfo() (*pb.BlockchainInfo, error)
- func (l *KVLedger) GetBlocksIterator(startBlockNumber uint64) (ledger.ResultsIterator, error)
- func (l *KVLedger) GetTransactionByID(txID string) (*pb.Transaction, error)
- func (l *KVLedger) NewQueryExecutor() (ledger.QueryExecutor, error)
- func (l *KVLedger) NewTxSimulator() (ledger.TxSimulator, error)
- func (l *KVLedger) Prune(policy ledger.PrunePolicy) error
- func (l *KVLedger) RemoveInvalidTransactionsAndPrepare(block *common.Block) (*common.Block, []*pb.InvalidTransaction, error)
- func (l *KVLedger) Rollback()
- type LedgerCreateErr
- type LedgerExistsErr
- type LedgerNotInitializedErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conf ¶
type Conf struct {
// contains filtered or unexported fields
}
Conf captures `KVLedger` configurations
type KVLedger ¶
type KVLedger struct {
// contains filtered or unexported fields
}
KVLedger provides an implementation of `ledger.ValidatedLedger`. This implementation provides a key-value based data model
func CreateLedger ¶
CreateLedger creates a ledger if one does not exist
func NewKVLedger ¶
NewKVLedger constructs new `KVLedger`
func (*KVLedger) Commit ¶
Commit commits the valid block (returned in the method RemoveInvalidTransactionsAndPrepare) and related state changes
func (*KVLedger) GetBlockByHash ¶
GetBlockByHash returns a block given it's hash
func (*KVLedger) GetBlockByNumber ¶
GetBlockByNumber returns block at a given height
func (*KVLedger) GetBlockchainInfo ¶
func (l *KVLedger) GetBlockchainInfo() (*pb.BlockchainInfo, error)
GetBlockchainInfo returns basic info about blockchain
func (*KVLedger) GetBlocksIterator ¶
func (l *KVLedger) GetBlocksIterator(startBlockNumber uint64) (ledger.ResultsIterator, error)
GetBlocksIterator returns an iterator that starts from `startBlockNumber`(inclusive). The iterator is a blocking iterator i.e., it blocks till the next block gets available in the ledger ResultsIterator contains type BlockHolder
func (*KVLedger) GetTransactionByID ¶
func (l *KVLedger) GetTransactionByID(txID string) (*pb.Transaction, error)
GetTransactionByID retrieves a transaction by id
func (*KVLedger) NewQueryExecutor ¶
func (l *KVLedger) NewQueryExecutor() (ledger.QueryExecutor, error)
NewQueryExecutor gives handle to a query executer. A client can obtain more than one 'QueryExecutor's for parallel execution. Any synchronization should be performed at the implementation level if required
func (*KVLedger) NewTxSimulator ¶
func (l *KVLedger) NewTxSimulator() (ledger.TxSimulator, error)
NewTxSimulator returns new `ledger.TxSimulator`
func (*KVLedger) Prune ¶
func (l *KVLedger) Prune(policy ledger.PrunePolicy) error
Prune prunes the blocks/transactions that satisfy the given policy
func (*KVLedger) RemoveInvalidTransactionsAndPrepare ¶
func (l *KVLedger) RemoveInvalidTransactionsAndPrepare(block *common.Block) (*common.Block, []*pb.InvalidTransaction, error)
RemoveInvalidTransactionsAndPrepare validates all the transactions in the given block and returns a block that contains only valid transactions and a list of transactions that are invalid
type LedgerCreateErr ¶
type LedgerCreateErr string
LedgerCreateErr exists error
func (LedgerCreateErr) Error ¶
func (l LedgerCreateErr) Error() string
type LedgerExistsErr ¶
type LedgerExistsErr string
LedgerExistsErr exists error
func (LedgerExistsErr) Error ¶
func (l LedgerExistsErr) Error() string
type LedgerNotInitializedErr ¶
type LedgerNotInitializedErr string
LedgerNotInitializedErr exists error
func (LedgerNotInitializedErr) Error ¶
func (l LedgerNotInitializedErr) Error() string