Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterChaincodeProviderFactory ¶
func RegisterChaincodeProviderFactory(ccfact ChaincodeProviderFactory)
RegisterChaincodeProviderFactory is to be called once to set the factory that will be used to obtain instances of ChaincodeProvider
Types ¶
type CCContext ¶
type CCContext struct {
//ChainID chain id
ChainID string
//Name chaincode name
Name string
//Version used to construct the chaincode image and register
Version string
//TxID is the transaction id for the proposal (if any)
TxID string
//Syscc is this a system chaincode
Syscc bool
//Proposal for this invoke (if any)
//this is kept here just in case we need to pass something
//from this to the chaincode
Proposal *pb.Proposal
// contains filtered or unexported fields
}
CCContext pass this around instead of string of args
func NewCCContext ¶
NewCCContext just construct a new struct with whatever args
func (*CCContext) GetCanonicalName ¶
GetCanonicalName returns the canonical name associated with the proposal context
type ChaincodeData ¶
type ChaincodeData struct {
Name string `protobuf:"bytes,1,opt,name=name"`
Version string `protobuf:"bytes,2,opt,name=version"`
DepSpec []byte `protobuf:"bytes,3,opt,name=depSpec,proto3"`
Escc string `protobuf:"bytes,4,opt,name=escc"`
Vscc string `protobuf:"bytes,5,opt,name=vscc"`
Policy []byte `protobuf:"bytes,6,opt,name=policy"`
}
ChaincodeData defines the datastructure for chaincodes to be serialized by proto
func (*ChaincodeData) ProtoMessage ¶
func (*ChaincodeData) ProtoMessage()
ProtoMessage just exists to make proto happy
type ChaincodeProvider ¶
type ChaincodeProvider interface {
// GetContext returns a ledger context
GetContext(ledger ledger.PeerLedger) (context.Context, error)
// GetCCContext returns an opaque chaincode context
GetCCContext(cid, name, version, txid string, syscc bool, prop *pb.Proposal) interface{}
// GetCCValidationInfoFromLCCC returns the VSCC and the policy listed by LCCC for the supplied chaincode
GetCCValidationInfoFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, chaincodeID string) (string, []byte, error)
// ExecuteChaincode executes the chaincode given context and args
ExecuteChaincode(ctxt context.Context, cccid interface{}, args [][]byte) (*pb.Response, *pb.ChaincodeEvent, error)
// Execute executes the chaincode given context and spec (invocation or deploy)
Execute(ctxt context.Context, cccid interface{}, spec interface{}) (*pb.Response, *pb.ChaincodeEvent, error)
// ExecuteWithErrorFilder executes the chaincode given context and spec and returns payload
ExecuteWithErrorFilter(ctxt context.Context, cccid interface{}, spec interface{}) ([]byte, *pb.ChaincodeEvent, error)
// Stop stops the chaincode given context and deployment spec
Stop(ctxt context.Context, cccid interface{}, spec *pb.ChaincodeDeploymentSpec) error
// ReleaseContext releases the context returned previously by GetContext
ReleaseContext()
}
ChaincodeProvider provides an abstraction layer that is used for different packages to interact with code in the chaincode package without importing it; more methods should be added below if necessary
func GetChaincodeProvider ¶
func GetChaincodeProvider() ChaincodeProvider
GetChaincodeProvider returns instances of ChaincodeProvider; the actual implementation is controlled by the factory that is registered via RegisterChaincodeProviderFactory
type ChaincodeProviderFactory ¶
type ChaincodeProviderFactory interface {
NewChaincodeProvider() ChaincodeProvider
}
ChaincodeProviderFactory defines a factory interface so that the actual implementation can be injected