Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChaincodeDefinition ¶
ChaincodeDefinition captures the info about chaincode
func (*ChaincodeDefinition) String ¶
func (cdef *ChaincodeDefinition) String() string
type ChaincodeInfoProvider ¶
type ChaincodeInfoProvider interface { // IsChaincodeDeployed returns true if the given chaincode is deployed on the given channel IsChaincodeDeployed(chainid string, chaincodeDefinition *ChaincodeDefinition) (bool, error) // RetrieveChaincodeArtifacts checks if the given chaincode is installed on the peer and if yes, // it extracts the state db specific artifacts from the chaincode package tarball RetrieveChaincodeArtifacts(chaincodeDefinition *ChaincodeDefinition) (installed bool, dbArtifactsTar []byte, err error) }
ChaincodeInfoProvider interface enables event mgr to retrieve chaincode info for a given chaincode
type ChaincodeLifecycleEventListener ¶
type ChaincodeLifecycleEventListener interface { // HandleChaincodeDeploy is expected to creates all the necessary statedb structures (such as indexes) HandleChaincodeDeploy(chaincodeDefinition *ChaincodeDefinition, dbArtifactsTar []byte) error }
ChaincodeLifecycleEventListener interface enables ledger components (mainly, intended for statedb) to be able to listen to chaincode lifecycle events. 'dbArtifactsTar' represents db specific artifacts (such as index specs) packaged in a tar
type KVLedgerLSCCStateListener ¶
type KVLedgerLSCCStateListener struct { }
KVLedgerLSCCStateListener listens for state changes on 'lscc' namespace
func (*KVLedgerLSCCStateListener) HandleStateUpdates ¶
func (listener *KVLedgerLSCCStateListener) HandleStateUpdates(channelName string, stateUpdates ledger.StateUpdates) error
HandleStateUpdates iterates over key-values being written in the 'lscc' namespace (which indicates deployment of a chaincode) and invokes `HandleChaincodeDeploy` function on chaincode event manager (which in turn is responsible for creation of statedb artifacts for the chaincode statedata)
type Mgr ¶
type Mgr struct {
// contains filtered or unexported fields
}
Mgr encapsulate important interactions for events related to the interest of ledger
func (*Mgr) HandleChaincodeDeploy ¶
func (m *Mgr) HandleChaincodeDeploy(chainid string, chaincodeDefinitions []*ChaincodeDefinition) error
HandleChaincodeDeploy is expected to be invoked when a chaincode is deployed via a deploy transaction The `chaincodeDefinitions` parameter contains all the chaincodes deployed in a block We need to store the last received `chaincodeDefinitions` because this function is expected to be invoked after the deploy transactions validation is performed but not committed yet to the ledger. Further, we release the read lock after this function. This leaves a small window when a `chaincode install` can happen before the deploy transaction is committed and hence the function `HandleChaincodeInstall` may miss finding the deployed chaincode. So, in function `HandleChaincodeInstall`, we explicitly check for chaincode deployed in this stored `chaincodeDefinitions`
func (*Mgr) HandleChaincodeInstall ¶
func (m *Mgr) HandleChaincodeInstall(chaincodeDefinition *ChaincodeDefinition, dbArtifacts []byte) error
HandleChaincodeInstall is expected to gets invoked when a during installation of a chaincode package
func (*Mgr) Register ¶
func (m *Mgr) Register(ledgerid string, l ChaincodeLifecycleEventListener)
Register registers a ChaincodeLifecycleEventListener for given ledgerid Since, `Register` is expected to be invoked when creating/opening a ledger instance