{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lifecycle\n\n## Constants\n\n```go\nconst (\n\t//InstalledChaincodeFuncName is the chaincode function name used to install a chaincode\n\tInstallChaincodeFuncName = \"InstallChaincode\"\n\n\t// QueryInstalledChaincodeFuncName is the chaincode function name used to query an installed chaincode\n\tQueryInstalledChaincodeFuncName = \"QueryInstalledChaincode\"\n)\n```\n\n## Types\n\n```go\ntype ChaincodeStore interface {\n\tSave(name, version string, ccInstallPkg []byte) (hash []byte, err error)\n\tRetrieveHash(name, version string) (hash []byte, err error)\n}\n```\nChaincodeStore provides a way to persist chaincodes\n\n```go\ntype Lifecycle struct {\n\tChaincodeStore ChaincodeStore\n\tPackageParser  PackageParser\n}\n```\nLifecycle implements the lifecycle operations which are invoked by the SCC as well as internally\n\n```go\nfunc (l *Lifecycle) InstallChaincode(name, version string, chaincodeInstallPackage []byte) ([]byte, error)\n```\nInstallChaincode installs a given chaincode to the peer's chaincode store. It returns the hash to reference the chaincode by or an error on failure.\n\n```go\nfunc (l *Lifecycle) QueryInstalledChaincode(name, version string) ([]byte, error)\n```\nQueryInstalledChaincode returns the hash of an installed chaincode of a given name and version.\n\n```go\ntype PackageParser interface {\n\tParse(data []byte) (*persistence.ChaincodePackage, error)\n}\n```\n\n```go\ntype Protobuf interface {\n\tMarshal(msg proto.Message) (marshaled []byte, err error)\n\tUnmarshal(marshaled []byte, msg proto.Message) error\n}\n```\nProtobuf defines the subset of protobuf lifecycle needs and allows for injection of mocked marshaling errors.\n\n```go\ntype ProtobufImpl struct{}\n```\nProtobufImpl is the standard implementation to use for Protobuf\n\n```go\nfunc (p ProtobufImpl) Marshal(msg proto.Message) ([]byte, error)\n```\nMarshal passes through to proto.Marshal\n\n```go\nfunc (p ProtobufImpl) Unmarshal(marshaled []byte, msg proto.Message) error\n```\nUnmarshal passes through to proto.Unmarshal\n\n```go\ntype SCC struct {\n\tProtobuf  Protobuf\n\tFunctions SCCFunctions\n}\n```\nSCC implements the required methods to satisfy the chaincode interface. It routes the invocation calls to the backing implementations.\n\n```go\nfunc (scc *SCC) Chaincode() shim.Chaincode\n```\nChaincode returns a reference to itself\n\n```go\nfunc (scc *SCC) Enabled() bool\n```\nEnabled returns true\n\n```go\nfunc (scc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response\n```\nInit is mostly useless for system chaincodes and always returns success\n\n```go\nfunc (scc *SCC) InitArgs() [][]byte\n```\nInitArgs returns nil\n\n```go\nfunc (scc *SCC) InvokableCC2CC() bool\n```\nInvokableCC2CC returns true\n\n```go\nfunc (scc *SCC) InvokableExternal() bool\n```\nInvokableExternal returns true\n\n```go\nfunc (scc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response\n```\nInvoke takes chaincode invocation arguments and routes them to the correct underlying lifecycle operation.  All functions take a single argument of type marshaled lb.\\\u003cFunctionName\u003eArgs and return a marshaled lb.\\\u003cFunctionName\u003eResult\n\n```go\nfunc (scc *SCC) Name() string\n```\nName returns \"+lifecycle\"\n\n```go\nfunc (scc *SCC) Path() string\n```\nPath returns \"github.com/hyperledger/fabric/core/chaincode/lifecycle\"\n\n```go\ntype SCCFunctions interface {\n\t// InstallChaincode persists a chaincode definition to disk\n\tInstallChaincode(name, version string, chaincodePackage []byte) (hash []byte, err error)\n\n\t// QueryInstalledChaincode returns the hash for a given name and version of an installed chaincode\n\tQueryInstalledChaincode(name, version string) (hash []byte, err error)\n}\n```\nSCCFunctions provides a backing implementation with concrete arguments for each of the SCC functions\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/chaincode/lifecycle","name":"lifecycle","synopsis":"","isRedistributable":true}
