fabric: github.com/hyperledger/fabric/core/chaincode/lifecycle Index | Files | Directories

package lifecycle

import "github.com/hyperledger/fabric/core/chaincode/lifecycle"

Index

Package Files

lifecycle.go protobuf.go scc.go

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"
)

type ChaincodeStore Uses

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 Uses

type Lifecycle struct {
    ChaincodeStore ChaincodeStore
    PackageParser  PackageParser
}

Lifecycle implements the lifecycle operations which are invoked by the SCC as well as internally

func (*Lifecycle) InstallChaincode Uses

func (l *Lifecycle) InstallChaincode(name, version string, chaincodeInstallPackage []byte) ([]byte, error)

InstallChaincode installs a given chaincode to the peer's chaincode store. It returns the hash to reference the chaincode by or an error on failure.

func (*Lifecycle) QueryInstalledChaincode Uses

func (l *Lifecycle) QueryInstalledChaincode(name, version string) ([]byte, error)

QueryInstalledChaincode returns the hash of an installed chaincode of a given name and version.

type PackageParser Uses

type PackageParser interface {
    Parse(data []byte) (*persistence.ChaincodePackage, error)
}

type Protobuf Uses

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 Uses

type ProtobufImpl struct{}

ProtobufImpl is the standard implementation to use for Protobuf

func (ProtobufImpl) Marshal Uses

func (p ProtobufImpl) Marshal(msg proto.Message) ([]byte, error)

Marshal passes through to proto.Marshal

func (ProtobufImpl) Unmarshal Uses

func (p ProtobufImpl) Unmarshal(marshaled []byte, msg proto.Message) error

Unmarshal passes through to proto.Unmarshal

type SCC Uses

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) Chaincode Uses

func (scc *SCC) Chaincode() shim.Chaincode

Chaincode returns a reference to itself

func (*SCC) Enabled Uses

func (scc *SCC) Enabled() bool

Enabled returns true

func (*SCC) Init Uses

func (scc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response

Init is mostly useless for system chaincodes and always returns success

func (*SCC) InitArgs Uses

func (scc *SCC) InitArgs() [][]byte

InitArgs returns nil

func (*SCC) InvokableCC2CC Uses

func (scc *SCC) InvokableCC2CC() bool

InvokableCC2CC returns true

func (*SCC) InvokableExternal Uses

func (scc *SCC) InvokableExternal() bool

InvokableExternal returns true

func (*SCC) Invoke Uses

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

func (*SCC) Name Uses

func (scc *SCC) Name() string

Name returns "+lifecycle"

func (*SCC) Path Uses

func (scc *SCC) Path() string

Path returns "github.com/hyperledger/fabric/core/chaincode/lifecycle"

type SCCFunctions Uses

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

Directories

PathSynopsis
mockCode generated by counterfeiter.

Package lifecycle imports 7 packages (graph) and is imported by 1 packages. Updated 2019-07-21. Refresh now. Tools for package owners.