fabric: github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr Index | Files

package lockbasedtxmgr

import "github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr"

Index

Package Files

collection_val.go helper.go lockbased_query_executer.go lockbased_tx_simulator.go lockbased_txmgr.go

type LockBasedTxMgr Uses

type LockBasedTxMgr 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 NewLockBasedTxMgr Uses

func NewLockBasedTxMgr(
    ledgerid string,
    db privacyenabledstate.DB,
    stateListeners []ledger.StateListener,
    btlPolicy pvtdatapolicy.BTLPolicy,
    bookkeepingProvider bookkeeping.Provider,
    ccInfoProvider ledger.DeployedChaincodeInfoProvider,
    customTxProcessors map[common.HeaderType]ledger.CustomTxProcessor,
    hasher ledger.Hasher,
) (*LockBasedTxMgr, error)

NewLockBasedTxMgr constructs a new instance of NewLockBasedTxMgr

func (*LockBasedTxMgr) Commit Uses

func (txmgr *LockBasedTxMgr) Commit() error

Commit implements method in interface `txmgmt.TxMgr`

func (*LockBasedTxMgr) CommitLostBlock Uses

func (txmgr *LockBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error

CommitLostBlock implements method in interface kvledger.Recoverer

func (*LockBasedTxMgr) GetLastSavepoint Uses

func (txmgr *LockBasedTxMgr) GetLastSavepoint() (*version.Height, error)

GetLastSavepoint returns the block num recorded in savepoint, returns 0 if NO savepoint is found

func (*LockBasedTxMgr) Name Uses

func (txmgr *LockBasedTxMgr) Name() string

Name returns the name of the database that manages all active states.

func (*LockBasedTxMgr) NewQueryExecutor Uses

func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)

NewQueryExecutor implements method in interface `txmgmt.TxMgr`

func (*LockBasedTxMgr) NewQueryExecutorNoCollChecks Uses

func (txmgr *LockBasedTxMgr) NewQueryExecutorNoCollChecks() (ledger.QueryExecutor, error)

NewQueryExecutorWithNoCollChecks is a workaround to make the initilization of lifecycle cache work. The issue is that in the current lifecycle code the cache is initialized via Initialize function of a statelistener which gets invoked during ledger opening. This invovation eventually leads to a call to DeployedChaincodeInfoProvider which inturn needs the channel config in order to varify the name of the implicit collection. And the channelconfig is loaded only after the ledger is opened. So, as a workaround, we skip the check of collection name in this function by supplying a relaxed query executor - This is perfectly safe otherwise. As a proper fix, the initialization of other components should take place outside ledger by explicit querying the ledger state so that the sequence of initialization is explicitly controlled. However that needs a bigger refactoring of code.

func (*LockBasedTxMgr) NewTxSimulator Uses

func (txmgr *LockBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)

NewTxSimulator implements method in interface `txmgmt.TxMgr`

func (*LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks Uses

func (txmgr *LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(reconciledPvtdata map[uint64][]*ledger.TxPvtData) error

RemoveStaleAndCommitPvtDataOfOldBlocks implements method in interface `txmgmt.TxMgr` The following six operations are performed: (1) constructs the unique pvt data from the passed reconciledPvtdata (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, kvledger (a single consumer of this function), filters out the data of "invalid" transactions and supplies the data for "valid" transactions only.

func (*LockBasedTxMgr) Rollback Uses

func (txmgr *LockBasedTxMgr) Rollback()

Rollback implements method in interface `txmgmt.TxMgr`

func (*LockBasedTxMgr) ShouldRecover Uses

func (txmgr *LockBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)

ShouldRecover implements method in interface kvledger.Recoverer

func (*LockBasedTxMgr) Shutdown Uses

func (txmgr *LockBasedTxMgr) Shutdown()

Shutdown implements method in interface `txmgmt.TxMgr`

func (*LockBasedTxMgr) ValidateAndPrepare Uses

func (txmgr *LockBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) (
    []*txmgr.TxStatInfo, []byte, error,
)

ValidateAndPrepare implements method in interface `txmgmt.TxMgr`

Package lockbasedtxmgr imports 25 packages (graph) and is imported by 9 packages. Updated 2019-11-18. Refresh now. Tools for package owners.