Documentation ¶
Index ¶
- type SnapshotBasedQueryExecutor
- func (q *SnapshotBasedQueryExecutor) Done()
- func (q *SnapshotBasedQueryExecutor) ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error)
- func (q *SnapshotBasedQueryExecutor) ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error)
- func (q *SnapshotBasedQueryExecutor) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)
- func (q *SnapshotBasedQueryExecutor) GetPrivateData(namespace, collection, key string) ([]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error)
- func (q *SnapshotBasedQueryExecutor) GetState(ns string, key string) (val []byte, err error)
- func (q *SnapshotBasedQueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)
- func (q *SnapshotBasedQueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error)
- func (q *SnapshotBasedQueryExecutor) GetStateRangeScanIteratorWithMetadata(namespace string, startKey string, endKey string, ...) (ledger.QueryResultsIterator, error)
- type SnapshotBasedTxMgr
- func (txmgr *SnapshotBasedTxMgr) Commit() error
- func (txmgr *SnapshotBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error
- func (txmgr *SnapshotBasedTxMgr) GetLastSavepoint() (*version.Height, error)
- func (txmgr *SnapshotBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)
- func (txmgr *SnapshotBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)
- func (txmgr *SnapshotBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error
- func (txmgr *SnapshotBasedTxMgr) Rollback()
- func (txmgr *SnapshotBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)
- func (txmgr *SnapshotBasedTxMgr) Shutdown()
- func (txmgr *SnapshotBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ([]*txmgr.TxStatInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SnapshotBasedQueryExecutor ¶
type SnapshotBasedQueryExecutor struct {
// contains filtered or unexported fields
}
SnapshotBasedQueryExecutor is a query executor used in `SnapshotBasedTxMgr`
func (*SnapshotBasedQueryExecutor) Done ¶
func (q *SnapshotBasedQueryExecutor) Done()
Done implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) ExecuteQuery ¶
func (q *SnapshotBasedQueryExecutor) ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error)
ExecuteQuery implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) ExecuteQueryOnPrivateData ¶
func (q *SnapshotBasedQueryExecutor) ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error)
ExecuteQueryOnPrivateData implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) ExecuteQueryWithMetadata ¶
func (q *SnapshotBasedQueryExecutor) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)
ExecuteQueryWithMetadata implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetPrivateData ¶
func (q *SnapshotBasedQueryExecutor) GetPrivateData(namespace, collection, key string) ([]byte, error)
GetPrivateData implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetPrivateDataMetadata ¶
func (q *SnapshotBasedQueryExecutor) GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)
GetPrivateDataMetadata implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetPrivateDataMetadataByHash ¶
func (q *SnapshotBasedQueryExecutor) GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error)
GetPrivateDataMetadataByHash implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetPrivateDataMultipleKeys ¶
func (q *SnapshotBasedQueryExecutor) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error)
GetPrivateDataMultipleKeys implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetPrivateDataRangeScanIterator ¶
func (q *SnapshotBasedQueryExecutor) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error)
GetPrivateDataRangeScanIterator implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetState ¶
func (q *SnapshotBasedQueryExecutor) GetState(ns string, key string) (val []byte, err error)
GetState implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetStateMetadata ¶
func (q *SnapshotBasedQueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, error)
GetStateMetadata implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetStateMultipleKeys ¶
func (q *SnapshotBasedQueryExecutor) GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)
GetStateMultipleKeys implements method in interface `ledger.QueryExecutor`
func (*SnapshotBasedQueryExecutor) GetStateRangeScanIterator ¶
func (q *SnapshotBasedQueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error)
GetStateRangeScanIterator implements method in interface `ledger.QueryExecutor` startKey is included in the results and endKey is excluded. An empty startKey refers to the first available key and an empty endKey refers to the last available key. For scanning all the keys, both the startKey and the endKey can be supplied as empty strings. However, a full scan shuold be used judiciously for performance reasons.
func (*SnapshotBasedQueryExecutor) GetStateRangeScanIteratorWithMetadata ¶
func (q *SnapshotBasedQueryExecutor) GetStateRangeScanIteratorWithMetadata(namespace string, startKey string, endKey string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)
GetStateRangeScanIteratorWithMetadata implements method in interface `ledger.QueryExecutor` startKey is included in the results and endKey is excluded. An empty startKey refers to the first available key and an empty endKey refers to the last available key. For scanning all the keys, both the startKey and the endKey can be supplied as empty strings. However, a full scan shuold be used judiciously for performance reasons. metadata is a map of additional query parameters
type SnapshotBasedTxMgr ¶
type SnapshotBasedTxMgr struct {
// contains filtered or unexported fields
}
LockBasedTxMgr a simple implementation of interface `txmgmt.TxMgr`. This implementation uses a read-write lock to prevent conflicts between transaction simulation and committing
func NewSnapshotBasedTxMgr ¶
func NewSnapshotBasedTxMgr(ledgerid string, db privacyenabledstate.DB, stateListeners []ledger.StateListener, btlPolicy pvtdatapolicy.BTLPolicy, bookkeepingProvider bookkeeping.Provider) (*SnapshotBasedTxMgr, error)
NewLockBasedTxMgr constructs a new instance of NewLockBasedTxMgr
func (*SnapshotBasedTxMgr) Commit ¶
func (txmgr *SnapshotBasedTxMgr) Commit() error
Commit implements method in interface `txmgmt.TxMgr`
func (*SnapshotBasedTxMgr) CommitLostBlock ¶
func (txmgr *SnapshotBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error
CommitLostBlock implements method in interface kvledger.Recoverer
func (*SnapshotBasedTxMgr) GetLastSavepoint ¶
func (txmgr *SnapshotBasedTxMgr) GetLastSavepoint() (*version.Height, error)
GetLastSavepoint returns the block num recorded in savepoint, returns 0 if NO savepoint is found
func (*SnapshotBasedTxMgr) NewQueryExecutor ¶
func (txmgr *SnapshotBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)
NewQueryExecutor implements method in interface `txmgmt.TxMgr`
func (*SnapshotBasedTxMgr) NewTxSimulator ¶
func (txmgr *SnapshotBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)
NewTxSimulator implements method in interface `txmgmt.TxMgr`
func (*SnapshotBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks ¶
func (txmgr *SnapshotBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error
RemoveStaleAndCommitPvtDataOfOldBlocks implements method in interface `txmgmt.TxMgr` The following six operations are performed: (1) contructs the unique pvt data from the passed blocksPvtData (2) acquire a lock on oldBlockCommit (3) checks for stale pvtData by comparing [version, valueHash] and removes stale data (4) creates update batch from the the non-stale pvtData (5) update the BTL bookkeeping managed by the purge manager and update expiring keys. (6) commit the non-stale pvt data to the stateDB This function assumes that the passed input contains only transactions that had been marked "Valid". In the current design, this assumption holds true as we store missing data info about only valid transactions. Further, gossip supplies only the missing pvtData of valid transactions. If these two assumptions are broken due to some bug, we are still safe from data consistency point of view as we match the version and the value hashes stored in the stateDB before committing the value. However, if pvtData of a tuple <ns, Coll, key> is passed for two (or more) transactions with one as valid and another as invalid transaction, we might miss to store a missing data forever if the version# of invalid tx is greater than the valid tx (as per our logic employed in constructUniquePvtData(). Other than a bug, there is another scenario in which this function might receive pvtData of both valid and invalid tx. Such a scenario is explained in FAB-12924 and is related to state fork and rebuilding ledger state.
func (*SnapshotBasedTxMgr) Rollback ¶
func (txmgr *SnapshotBasedTxMgr) Rollback()
Rollback implements method in interface `txmgmt.TxMgr`
func (*SnapshotBasedTxMgr) ShouldRecover ¶
func (txmgr *SnapshotBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)
ShouldRecover implements method in interface kvledger.Recoverer
func (*SnapshotBasedTxMgr) Shutdown ¶
func (txmgr *SnapshotBasedTxMgr) Shutdown()
Shutdown implements method in interface `txmgmt.TxMgr`
func (*SnapshotBasedTxMgr) ValidateAndPrepare ¶
func (txmgr *SnapshotBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ([]*txmgr.TxStatInfo, error)
ValidateAndPrepare implements method in interface `txmgmt.TxMgr`