Documentation ¶
Index ¶
- Constants
- type ChaincodeStore
- type Lifecycle
- type PackageParser
- type Protobuf
- type ProtobufImpl
- type SCC
- func (scc *SCC) Chaincode() shim.Chaincode
- func (scc *SCC) Enabled() bool
- func (scc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response
- func (scc *SCC) InitArgs() [][]byte
- func (scc *SCC) InvokableCC2CC() bool
- func (scc *SCC) InvokableExternal() bool
- func (scc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response
- func (scc *SCC) Name() string
- func (scc *SCC) Path() string
- type SCCFunctions
Constants ¶
const ( //InstalledChaincodeFuncName is the chaincode function name used to install a chaincode InstallChaincodeFuncName = "InstallChaincode" // QueryInstalledChaincodeFuncName is the chaincode function name used to query an installed chaincode QueryInstalledChaincodeFuncName = "QueryInstalledChaincode" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChaincodeStore ¶
type ChaincodeStore interface { Save(name, version string, ccInstallPkg []byte) (hash []byte, err error) RetrieveHash(name, version string) (hash []byte, err error) }
ChaincodeStore provides a way to persist chaincodes
type Lifecycle ¶
type Lifecycle struct { ChaincodeStore ChaincodeStore PackageParser PackageParser }
Lifecycle implements the lifecycle operations which are invoked by the SCC as well as internally
type PackageParser ¶
type PackageParser interface {
Parse(data []byte) (*persistence.ChaincodePackage, error)
}
type Protobuf ¶
type Protobuf interface { Marshal(msg proto.Message) (marshaled []byte, err error) Unmarshal(marshaled []byte, msg proto.Message) error }
Protobuf defines the subset of protobuf lifecycle needs and allows for injection of mocked marshaling errors.
type ProtobufImpl ¶
type ProtobufImpl struct{}
ProtobufImpl is the standard implementation to use for Protobuf
type SCC ¶
type SCC struct { Protobuf Protobuf Functions SCCFunctions }
SCC implements the required methods to satisfy the chaincode interface. It routes the invocation calls to the backing implementations.
func (*SCC) Init ¶
func (scc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response
Init is mostly useless for system chaincodes and always returns success
func (*SCC) InvokableExternal ¶
InvokableExternal returns true
func (*SCC) Invoke ¶
func (scc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response
Invoke takes chaincode invocation arguments and routes them to the correct underlying lifecycle operation. All functions take a single argument of type marshaled lb.<FunctionName>Args and return a marshaled lb.<FunctionName>Result
type SCCFunctions ¶
type SCCFunctions interface { // InstallChaincode persists a chaincode definition to disk InstallChaincode(name, version string, chaincodePackage []byte) (hash []byte, err error) // QueryInstalledChaincode returns the hash for a given name and version of an installed chaincode QueryInstalledChaincode(name, version string) (hash []byte, err error) }
SCCFunctions provides a backing implementation with concrete arguments for each of the SCC functions