Documentation ¶
Index ¶
- Constants
- Variables
- type ChaincodeBuilder
- type ChaincodeMismatchErr
- type CollectionsConfigUpgradesNotAllowed
- type DeployedCCInfoProvider
- func (p *DeployedCCInfoProvider) AllChaincodesInfo(channelName string, qe ledger.SimpleQueryExecutor) (map[string]*ledger.DeployedChaincodeInfo, error)
- func (p *DeployedCCInfoProvider) AllCollectionsConfigPkg(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) (*peer.CollectionConfigPackage, error)
- func (p *DeployedCCInfoProvider) ChaincodeInfo(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) (*ledger.DeployedChaincodeInfo, error)
- func (p *DeployedCCInfoProvider) CollectionInfo(channelName, chaincodeName, collectionName string, ...) (*peer.StaticCollectionConfig, error)
- func (p *DeployedCCInfoProvider) GenerateImplicitCollectionForOrg(mspid string) *peer.StaticCollectionConfig
- func (p *DeployedCCInfoProvider) ImplicitCollections(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) ([]*peer.StaticCollectionConfig, error)
- func (p *DeployedCCInfoProvider) Namespaces() []string
- func (p *DeployedCCInfoProvider) UpdatedChaincodes(stateUpdates map[string][]*kvrwset.KVWrite) ([]*ledger.ChaincodeLifecycleInfo, error)
- type ExistsErr
- type FilesystemSupport
- type IdenticalVersionErr
- type InstantiationPolicyMissing
- type InvalidArgsLenErr
- type InvalidCCOnFSError
- type InvalidChaincodeNameErr
- type InvalidChannelNameErr
- type InvalidDeploymentSpecErr
- type InvalidFunctionErr
- type InvalidStatedbArtifactsErr
- type InvalidVersionErr
- type LegacySecurity
- type MSPIDsGetter
- type MarshallErr
- type NotFoundErr
- type PackageCache
- type PeerShim
- type PrivateChannelDataNotAvailable
- type SCC
- func (lscc *SCC) Chaincode() shim.Chaincode
- func (lscc *SCC) ChaincodeEndorsementInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error)
- func (lscc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response
- func (lscc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response
- func (lscc *SCC) Name() string
- func (lscc *SCC) ValidationInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (plugin string, args []byte, unexpectedErr error, validationErr error)
- type SupportImpl
- func (s *SupportImpl) CheckInstantiationPolicy(signedProp *pb.SignedProposal, chainName string, instantiationPolicy []byte) error
- func (s *SupportImpl) GetChaincodeFromLocalStorage(ccNameVersion string) (ccprovider.CCPackage, error)
- func (s *SupportImpl) GetChaincodesFromLocalStorage() (*pb.ChaincodeQueryResponse, error)
- func (s *SupportImpl) GetInstantiationPolicy(channel string, ccpack ccprovider.CCPackage) ([]byte, error)
- func (s *SupportImpl) PutChaincodeToLocalStorage(ccpack ccprovider.CCPackage) error
- type TXNotFoundErr
Constants ¶
const ( // INSTALL install command INSTALL = "install" // DEPLOY deploy command DEPLOY = "deploy" // UPGRADE upgrade chaincode UPGRADE = "upgrade" // CCEXISTS get chaincode CCEXISTS = "getid" // CHAINCODEEXISTS get chaincode alias CHAINCODEEXISTS = "ChaincodeExists" // GETDEPSPEC get ChaincodeDeploymentSpec GETDEPSPEC = "getdepspec" // GETDEPLOYMENTSPEC get ChaincodeDeploymentSpec alias GETDEPLOYMENTSPEC = "GetDeploymentSpec" // GETCCDATA get ChaincodeData GETCCDATA = "getccdata" // GETCHAINCODEDATA get ChaincodeData alias GETCHAINCODEDATA = "GetChaincodeData" // GETCHAINCODES gets the instantiated chaincodes on a channel GETCHAINCODES = "getchaincodes" // GETCHAINCODESALIAS gets the instantiated chaincodes on a channel GETCHAINCODESALIAS = "GetChaincodes" // GETINSTALLEDCHAINCODES gets the installed chaincodes on a peer GETINSTALLEDCHAINCODES = "getinstalledchaincodes" // GETINSTALLEDCHAINCODESALIAS gets the installed chaincodes on a peer GETINSTALLEDCHAINCODESALIAS = "GetInstalledChaincodes" // GETCOLLECTIONSCONFIG gets the collections config for a chaincode GETCOLLECTIONSCONFIG = "GetCollectionsConfig" // GETCOLLECTIONSCONFIGALIAS gets the collections config for a chaincode GETCOLLECTIONSCONFIGALIAS = "getcollectionsconfig" )
Variables ¶
var ( // NOTE these regular expressions should stay in sync with those defined in // core/chaincode/lifecycle/scc.go until LSCC has been removed. ChaincodeNameRegExp = regexp.MustCompile("^[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*$") ChaincodeVersionRegExp = regexp.MustCompile("^[A-Za-z0-9_.+-]+$") )
Functions ¶
This section is empty.
Types ¶
type ChaincodeBuilder ¶
type ChaincodeMismatchErr ¶
type ChaincodeMismatchErr string
ChaincodeMismatchErr chaincode name from two places don't match
func (ChaincodeMismatchErr) Error ¶
func (f ChaincodeMismatchErr) Error() string
type CollectionsConfigUpgradesNotAllowed ¶
type CollectionsConfigUpgradesNotAllowed string
CollectionsConfigUpgradesNotAllowed when V1_2 capability is not enabled
func (CollectionsConfigUpgradesNotAllowed) Error ¶
func (f CollectionsConfigUpgradesNotAllowed) Error() string
type DeployedCCInfoProvider ¶
type DeployedCCInfoProvider struct { }
DeployedCCInfoProvider implements interface ledger.DeployedChaincodeInfoProvider
func (*DeployedCCInfoProvider) AllChaincodesInfo ¶
func (p *DeployedCCInfoProvider) AllChaincodesInfo(channelName string, qe ledger.SimpleQueryExecutor) (map[string]*ledger.DeployedChaincodeInfo, error)
AllChaincodesInfo returns the mapping of chaincode name to DeployedChaincodeInfo for legacy chaincodes
func (*DeployedCCInfoProvider) AllCollectionsConfigPkg ¶
func (p *DeployedCCInfoProvider) AllCollectionsConfigPkg(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) (*peer.CollectionConfigPackage, error)
AllCollectionsConfigPkg implements function in interface ledger.DeployedChaincodeInfoProvider this implementation returns just the explicit collection config package as the implicit collections are not used with legacy lifecycle
func (*DeployedCCInfoProvider) ChaincodeInfo ¶
func (p *DeployedCCInfoProvider) ChaincodeInfo(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) (*ledger.DeployedChaincodeInfo, error)
ChaincodeInfo implements function in interface ledger.DeployedChaincodeInfoProvider
func (*DeployedCCInfoProvider) CollectionInfo ¶
func (p *DeployedCCInfoProvider) CollectionInfo(channelName, chaincodeName, collectionName string, qe ledger.SimpleQueryExecutor) (*peer.StaticCollectionConfig, error)
CollectionInfo implements function in interface ledger.DeployedChaincodeInfoProvider
func (*DeployedCCInfoProvider) GenerateImplicitCollectionForOrg ¶
func (p *DeployedCCInfoProvider) GenerateImplicitCollectionForOrg(mspid string) *peer.StaticCollectionConfig
GenerateImplicitCollectionForOrg is not implemented for legacy chaincodes
func (*DeployedCCInfoProvider) ImplicitCollections ¶
func (p *DeployedCCInfoProvider) ImplicitCollections(channelName, chaincodeName string, qe ledger.SimpleQueryExecutor) ([]*peer.StaticCollectionConfig, error)
func (*DeployedCCInfoProvider) Namespaces ¶
func (p *DeployedCCInfoProvider) Namespaces() []string
Namespaces implements function in interface ledger.DeployedChaincodeInfoProvider
func (*DeployedCCInfoProvider) UpdatedChaincodes ¶
func (p *DeployedCCInfoProvider) UpdatedChaincodes(stateUpdates map[string][]*kvrwset.KVWrite) ([]*ledger.ChaincodeLifecycleInfo, error)
UpdatedChaincodes implements function in interface ledger.DeployedChaincodeInfoProvider
type FilesystemSupport ¶
type FilesystemSupport interface { // PutChaincodeToLocalStorage stores the supplied chaincode // package to local storage (i.e. the file system) PutChaincodeToLocalStorage(ccprovider.CCPackage) error // GetChaincodeFromLocalStorage retrieves the chaincode package // for the requested chaincode, specified by name and version GetChaincodeFromLocalStorage(ccNameVersion string) (ccprovider.CCPackage, error) // GetChaincodesFromLocalStorage returns an array of all chaincode // data that have previously been persisted to local storage GetChaincodesFromLocalStorage() (*pb.ChaincodeQueryResponse, error) // GetInstantiationPolicy returns the instantiation policy for the // supplied chaincode (or the channel's default if none was specified) GetInstantiationPolicy(channel string, ccpack ccprovider.CCPackage) ([]byte, error) // CheckInstantiationPolicy checks whether the supplied signed proposal // complies with the supplied instantiation policy CheckInstantiationPolicy(signedProposal *pb.SignedProposal, chainName string, instantiationPolicy []byte) error }
FilesystemSupport contains functions that LSCC requires to execute its tasks
type IdenticalVersionErr ¶
type IdenticalVersionErr string
IdenticalVersionErr trying to upgrade to same version of Chaincode
func (IdenticalVersionErr) Error ¶
func (f IdenticalVersionErr) Error() string
type InstantiationPolicyMissing ¶
type InstantiationPolicyMissing string
InstantiationPolicyMissing when no existing instantiation policy is found when upgrading CC
func (InstantiationPolicyMissing) Error ¶
func (f InstantiationPolicyMissing) Error() string
type InvalidArgsLenErr ¶
type InvalidArgsLenErr int
InvalidArgsLenErr invalid arguments length error
func (InvalidArgsLenErr) Error ¶
func (i InvalidArgsLenErr) Error() string
type InvalidCCOnFSError ¶
type InvalidCCOnFSError string
InvalidCCOnFSError error due to mismatch between fingerprint on lscc and installed CC
func (InvalidCCOnFSError) Error ¶
func (f InvalidCCOnFSError) Error() string
type InvalidChaincodeNameErr ¶
type InvalidChaincodeNameErr string
InvalidChaincodeNameErr invalid chaincode name error
func (InvalidChaincodeNameErr) Error ¶
func (f InvalidChaincodeNameErr) Error() string
type InvalidChannelNameErr ¶
type InvalidChannelNameErr string
InvalidChannelNameErr invalid channel name error
func (InvalidChannelNameErr) Error ¶
func (f InvalidChannelNameErr) Error() string
type InvalidDeploymentSpecErr ¶
type InvalidDeploymentSpecErr string
InvalidDeploymentSpecErr invalid chaincode deployment spec error
func (InvalidDeploymentSpecErr) Error ¶
func (f InvalidDeploymentSpecErr) Error() string
type InvalidFunctionErr ¶
type InvalidFunctionErr string
InvalidFunctionErr invalid function error
func (InvalidFunctionErr) Error ¶
func (f InvalidFunctionErr) Error() string
type InvalidStatedbArtifactsErr ¶
type InvalidStatedbArtifactsErr string
InvalidStatedbArtifactsErr invalid state database artifacts error
func (InvalidStatedbArtifactsErr) Error ¶
func (f InvalidStatedbArtifactsErr) Error() string
type InvalidVersionErr ¶
type InvalidVersionErr string
InvalidVersionErr invalid version error
func (InvalidVersionErr) Error ¶
func (f InvalidVersionErr) Error() string
type LegacySecurity ¶
type LegacySecurity struct { Support FilesystemSupport PackageCache *PackageCache }
func (*LegacySecurity) SecurityCheckLegacyChaincode ¶
func (ls *LegacySecurity) SecurityCheckLegacyChaincode(cd *ccprovider.ChaincodeData) error
type MSPIDsGetter ¶
MSPsIDGetter is used to get the MSP IDs for a channel.
type MarshallErr ¶
type MarshallErr string
MarshallErr error marshaling/unmarshalling
func (MarshallErr) Error ¶
func (m MarshallErr) Error() string
type NotFoundErr ¶
type NotFoundErr string
NotFoundErr chaincode not registered with LSCC error
func (NotFoundErr) Error ¶
func (t NotFoundErr) Error() string
type PackageCache ¶
type PackageCache struct { Mutex sync.RWMutex ValidatedPackages map[string]*ccprovider.ChaincodeData }
type PeerShim ¶
PeerShim adapts the peer instance for use with LSCC by providing methods previously provided by the scc provider. If the lscc code weren't all getting deleted soon, it would probably be worth rewriting it to use these APIs directly rather that go through this shim, but it will be gone soon.
func (*PeerShim) GetApplicationConfig ¶
func (p *PeerShim) GetApplicationConfig(cid string) (channelconfig.Application, bool)
GetApplicationConfig returns the configtxapplication.SharedConfig for the channel and whether the Application config exists
func (*PeerShim) GetQueryExecutorForLedger ¶
func (p *PeerShim) GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)
GetQueryExecutorForLedger returns a query executor for the specified channel
type PrivateChannelDataNotAvailable ¶
type PrivateChannelDataNotAvailable string
PrivateChannelDataNotAvailable when V1_2 or later capability is not enabled
func (PrivateChannelDataNotAvailable) Error ¶
func (f PrivateChannelDataNotAvailable) Error() string
type SCC ¶
type SCC struct { // aclProvider is responsible for access control evaluation ACLProvider aclmgmt.ACLProvider BuiltinSCCs scc.BuiltinSCCs // SCCProvider is the interface which is passed into system chaincodes // to access other parts of the system SCCProvider sysccprovider.SystemChaincodeProvider // PolicyChecker is the interface used to perform // access control PolicyChecker policy.PolicyChecker // Support provides the implementation of several // static functions Support FilesystemSupport GetMSPIDs MSPIDsGetter BuildRegistry *container.BuildRegistry ChaincodeBuilder ChaincodeBuilder EbMetadataProvider *externalbuilder.MetadataProvider // BCCSP instance BCCSP bccsp.BCCSP PackageCache PackageCache }
SCC implements chaincode lifecycle and policies around it
func (*SCC) ChaincodeEndorsementInfo ¶
func (lscc *SCC) ChaincodeEndorsementInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error)
func (*SCC) Init ¶
func (lscc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response
Init is mostly useless for SCC
func (*SCC) Invoke ¶
func (lscc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response
Invoke implements lifecycle functions "deploy", "start", "stop", "upgrade". Deploy's arguments - {[]byte("deploy"), []byte(<chainname>), <unmarshalled pb.ChaincodeDeploymentSpec>}
Invoke also implements some query-like functions Get chaincode arguments - {[]byte("getid"), []byte(<chainname>), []byte(<chaincodename>)}
func (*SCC) ValidationInfo ¶
func (lscc *SCC) ValidationInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (plugin string, args []byte, unexpectedErr error, validationErr error)
ValidationInfo returns name&arguments of the validation plugin for the supplied chaincode. The function returns two types of errors, unexpected errors and validation errors. The reason for this is that this function is to be called from the validation code, which needs to tell apart the two types of error to halt processing on the channel if the unexpected error is not nil and mark the transaction as invalid if the validation error is not nil.
type SupportImpl ¶
type SupportImpl struct {
GetMSPIDs MSPIDsGetter
}
func (*SupportImpl) CheckInstantiationPolicy ¶
func (s *SupportImpl) CheckInstantiationPolicy(signedProp *pb.SignedProposal, chainName string, instantiationPolicy []byte) error
CheckInstantiationPolicy checks whether the supplied signed proposal complies with the supplied instantiation policy
func (*SupportImpl) GetChaincodeFromLocalStorage ¶
func (s *SupportImpl) GetChaincodeFromLocalStorage(ccNameVersion string) (ccprovider.CCPackage, error)
GetChaincodeFromLocalStorage retrieves the chaincode package for the requested chaincode, specified by name and version
func (*SupportImpl) GetChaincodesFromLocalStorage ¶
func (s *SupportImpl) GetChaincodesFromLocalStorage() (*pb.ChaincodeQueryResponse, error)
GetChaincodesFromLocalStorage returns an array of all chaincode data that have previously been persisted to local storage
func (*SupportImpl) GetInstantiationPolicy ¶
func (s *SupportImpl) GetInstantiationPolicy(channel string, ccpack ccprovider.CCPackage) ([]byte, error)
GetInstantiationPolicy returns the instantiation policy for the supplied chaincode (or the channel's default if none was specified)
func (*SupportImpl) PutChaincodeToLocalStorage ¶
func (s *SupportImpl) PutChaincodeToLocalStorage(ccpack ccprovider.CCPackage) error
PutChaincodeToLocalStorage stores the supplied chaincode package to local storage (i.e. the file system)
type TXNotFoundErr ¶
type TXNotFoundErr string
TXNotFoundErr transaction not found error
func (TXNotFoundErr) Error ¶
func (t TXNotFoundErr) Error() string