Documentation ¶
Index ¶
- Constants
- func Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}, ...) (*pb.Response, *pb.ChaincodeEvent, error)
- func ExecuteChaincode(ctxt context.Context, cccid *ccprovider.CCContext, args [][]byte, ...) (*pb.Response, *pb.ChaincodeEvent, error)
- func ExecuteWithErrorFilter(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}, ...) ([]byte, *pb.ChaincodeEvent, error)
- func GetCDS(contractid []byte, ctxt context.Context, txid string, ...) ([]byte, error)
- func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, ...) error
- func IsDevMode() bool
- func NewChaincodeSupport(ccEndpoint string, userrunsCC bool, ccstartuptimeout time.Duration, ...) pb.ChaincodeSupportServer
- type ChaincodeDefinition
- type ChaincodeSupport
- func (chaincodeSupport *ChaincodeSupport) Destroy(context context.Context, cccid *ccprovider.CCContext, ...) error
- func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, ...) (*pb.ChaincodeMessage, error)
- func (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error
- func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec interface{}) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
- func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
- func (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, cccid *ccprovider.CCContext, ...) error
- type DuplicateChaincodeHandlerError
- type Handler
- type IAdapterJury
Constants ¶
const ( // DevModeUserRunsChaincode property allows user to run chaincode in development environment DevModeUserRunsChaincode string = "dev" //TXSimulatorKey is used to attach ledger simulation context TXSimulatorKey key = "txsimulatorkey" //glh // Mutual TLS auth client key and cert paths in the chaincode container TLSClientKeyPath string = "/etc/palletone/client.key" TLSClientCertPath string = "/etc/palletone/client.crt" TLSClientRootCertPath string = "/etc/palletone/peer.crt" )
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}, timeout time.Duration) (*pb.Response, *pb.ChaincodeEvent, error)
Execute - execute proposal, return original response of chaincode
func ExecuteChaincode ¶
func ExecuteChaincode(ctxt context.Context, cccid *ccprovider.CCContext, args [][]byte, timeout time.Duration) (*pb.Response, *pb.ChaincodeEvent, error)
ExecuteChaincode executes a given chaincode given chaincode name and arguments
func ExecuteWithErrorFilter ¶
func ExecuteWithErrorFilter(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}, timeout time.Duration) ([]byte, *pb.ChaincodeEvent, error)
ExecuteWithErrorFilter is similar to Execute, but filters error contained in chaincode response and returns Payload of response only. Mostly used by unit-test.
func GetCDS ¶
func GetCDS(contractid []byte, ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error)
GetCDS retrieves a chaincode deployment spec for the required chaincode
func HandleChaincodeStream ¶
func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, stream ccintf.ChaincodeStream, jury IAdapterJury) error
HandleChaincodeStream Main loop for handling the associated Chaincode stream
func IsDevMode ¶
func IsDevMode() bool
IsDevMode returns true if the peer was configured with development-mode enabled
func NewChaincodeSupport ¶
func NewChaincodeSupport(ccEndpoint string, userrunsCC bool, ccstartuptimeout time.Duration, ca accesscontrol.CA, jury IAdapterJury) pb.ChaincodeSupportServer
NewChaincodeSupport creates a new ChaincodeSupport instance
Types ¶
type ChaincodeDefinition ¶
type ChaincodeDefinition interface { // CCName returns the name of this chaincode (the name it was put in the ChaincodeRegistry with). CCName() string // Hash returns the hash of the chaincode. Hash() []byte // CCVersion returns the version of the chaincode. CCVersion() string // Validation returns how to validate transactions for this chaincode. // The string returned is the name of the validation method (usually 'vscc') // and the bytes returned are the argument to the validation (in the case of // 'vscc', this is a marshaled pb.VSCCArgs message). Validation() (string, []byte) // Endorsement returns how to endorse proposals for this chaincode. // The string returns is the name of the endorsement method (usually 'escc'). Endorsement() string }
glh add ChaincodeDefinition describes all of the necessary information for a peer to decide whether to endorse a proposal and whether to validate a transaction, for a particular chaincode.
func GetChaincodeDefinition ¶
func GetChaincodeDefinition(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (ChaincodeDefinition, error)
GetChaincodeDefinition returns resourcesconfig.ChaincodeDefinition for the chaincode with the supplied name
type ChaincodeSupport ¶
type ChaincodeSupport struct {
// contains filtered or unexported fields
}
// getLogLevelFromViper gets the chaincode container log levels from viper
func getLogLevelFromViper(module string) string { //levelString := viper.GetString("chaincode.logging." + module) //_, err := logging.LogLevel(levelString) // //if err == nil { // log.Debugf("CORE_CHAINCODE_%s set to level %s", strings.ToUpper(module), levelString) //} else { // log.Warnf("CORE_CHAINCODE_%s has invalid log level %s. defaulting to %s", strings.ToUpper(module), levelString, flogging.DefaultLevel()) // levelString = flogging.DefaultLevel() //} return flogging.DefaultLevel() }
ChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.
func GetChain ¶
func GetChain() *ChaincodeSupport
GetChain returns the chaincode framework support object
func (*ChaincodeSupport) Destroy ¶ added in v1.0.2
func (chaincodeSupport *ChaincodeSupport) Destroy(context context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error
func (*ChaincodeSupport) Execute ¶
func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error)
Execute executes a transaction and waits for it to complete until a timeout value.
func (*ChaincodeSupport) HandleChaincodeStream ¶
func (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error
HandleChaincodeStream implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream
func (*ChaincodeSupport) Launch ¶
func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec interface{}) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
Launch will launch the chaincode if not running (if running return nil) and will wait for handler of the chaincode to get into FSM ready state.
func (*ChaincodeSupport) Register ¶
func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
Register the bidi stream entry point called by chaincode to register with the Peer.
func (*ChaincodeSupport) Stop ¶
func (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec, dontRmCon bool) error
Stop stops a chaincode if running
type DuplicateChaincodeHandlerError ¶
type DuplicateChaincodeHandlerError struct {
ChaincodeID *pb.ChaincodeID
}
DuplicateChaincodeHandlerError returned if attempt to register same chaincodeID while a stream already exists.
func (*DuplicateChaincodeHandlerError) Error ¶
func (d *DuplicateChaincodeHandlerError) Error() string
type Handler ¶
type Handler struct { sync.RWMutex ChatStream ccintf.ChaincodeStream FSM *fsm.FSM ChaincodeID *pb.ChaincodeID // contains filtered or unexported fields }
Handler responsible for management of Peer's side of chaincode stream
type IAdapterJury ¶
type IAdapterJury interface { AdapterFunRequest(reqId common.Hash, contractId common.Address, msgType uint32, consultContent []byte, myAnswer []byte) ([]byte, error) AdapterFunResult(reqId common.Hash, contractId common.Address, msgType uint32, consultContent []byte, timeOut time.Duration) ([]byte, error) GetLocalJuryAddrs() []common.Address }