PluginConfig SCC plugin configuration
type PluginConfig struct { Enabled bool `mapstructure:"enabled" yaml:"enabled"` Name string `mapstructure:"name" yaml:"name"` Path string `mapstructure:"path" yaml:"path"` InvokableExternal bool `mapstructure:"invokableExternal" yaml:"invokableExternal"` InvokableCC2CC bool `mapstructure:"invokableCC2CC" yaml:"invokableCC2CC"` }
Provider implements sysccprovider.SystemChaincodeProvider
type Provider struct { Peer peer.Operations PeerSupport peer.Support Registrar Registrar SysCCs []SelfDescribingSysCC }
func NewProvider(pOps peer.Operations, pSup peer.Support, r Registrar) *Provider
NewProvider creates a new Provider instance
func (p *Provider) DeDeploySysCCs(chainID string, ccp ccprovider.ChaincodeProvider)
DeDeploySysCCs is used in unit tests to stop and remove the system chaincodes before restarting them in the same process. This allows clean start of the system in the same process
func (p *Provider) DeploySysCCs(chainID string, ccp ccprovider.ChaincodeProvider)
DeploySysCCs is the hook for system chaincodes where system chaincodes are registered with the fabric note the chaincode must still be deployed and launched like a user chaincode will be
func (p *Provider) GetApplicationConfig(cid string) (channelconfig.Application, bool)
GetApplicationConfig returns the configtxapplication.SharedConfig for the channel and whether the Application config exists
func (p *Provider) GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)
GetQueryExecutorForLedger returns a query executor for the specified channel
func (p *Provider) IsSysCC(name string) bool
IsSysCC returns true if the supplied chaincode is a system chaincode
func (p *Provider) IsSysCCAndNotInvokableCC2CC(name string) bool
IsSysCCAndNotInvokableCC2CC returns true if the chaincode is a system chaincode and *CANNOT* be invoked through a cc2cc invocation
func (p *Provider) IsSysCCAndNotInvokableExternal(name string) bool
IsSysCCAndNotInvokableExternal returns true if the chaincode is a system chaincode and *CANNOT* be invoked through a proposal to this peer
func (p *Provider) PolicyManager(channelID string) (policies.Manager, bool)
Returns the policy manager associated to the passed channel and whether the policy manager exists
func (p *Provider) RegisterSysCC(scc SelfDescribingSysCC)
RegisterSysCC registers a system chaincode with the syscc provider.
Registrar provides a way for system chaincodes to be registered
type Registrar interface { // Register registers a system chaincode Register(ccid *ccintf.CCID, cc shim.Chaincode) error }
type SelfDescribingSysCC interface { //Unique name of the system chaincode Name() string //Path to the system chaincode; currently not used Path() string //InitArgs initialization arguments to startup the system chaincode InitArgs() [][]byte // Chaincode returns the underlying chaincode Chaincode() shim.Chaincode // InvokableExternal keeps track of whether // this system chaincode can be invoked // through a proposal sent to this peer InvokableExternal() bool // InvokableCC2CC keeps track of whether // this system chaincode can be invoked // by way of a chaincode-to-chaincode // invocation InvokableCC2CC() bool // Enabled a convenient switch to enable/disable system chaincode without // having to remove entry from importsysccs.go Enabled() bool }
func CreatePluginSysCCs(p *Provider) []SelfDescribingSysCC
CreatePluginSysCCs creates all of the system chaincodes which are compiled into fabric
type SysCCWrapper struct { SCC *SystemChaincode }
func (sccw *SysCCWrapper) Chaincode() shim.Chaincode
func (sccw *SysCCWrapper) Enabled() bool
func (sccw *SysCCWrapper) InitArgs() [][]byte
func (sccw *SysCCWrapper) InvokableCC2CC() bool
func (sccw *SysCCWrapper) InvokableExternal() bool
func (sccw *SysCCWrapper) Name() string
func (sccw *SysCCWrapper) Path() string
SystemChaincode defines the metadata needed to initialize system chaincode when the fabric comes up. SystemChaincodes are installed by adding an entry in importsysccs.go
type SystemChaincode struct { //Unique name of the system chaincode Name string //Path to the system chaincode; currently not used Path string //InitArgs initialization arguments to startup the system chaincode InitArgs [][]byte // Chaincode holds the actual chaincode instance Chaincode shim.Chaincode // InvokableExternal keeps track of whether // this system chaincode can be invoked // through a proposal sent to this peer InvokableExternal bool // InvokableCC2CC keeps track of whether // this system chaincode can be invoked // by way of a chaincode-to-chaincode // invocation InvokableCC2CC bool // Enabled a convenient switch to enable/disable system chaincode without // having to remove entry from importsysccs.go Enabled bool }