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 GetCDSFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, ...) ([]byte, error)
- func GetChaincodeDataFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, ...) (*ccprovider.ChaincodeData, error)
- func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, ...) error
- func IsDevMode() bool
- func SetupTestConfig()
- func SetupTestLogging()
- type ChaincodeSupport
- 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 Config
- type DuplicateChaincodeHandlerError
- type Handler
- type MessageHandler
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" //HistoryQueryExecutorKey is used to attach ledger history query executor context HistoryQueryExecutorKey key = "historyqueryexecutorkey" )
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec interface{}) (*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) (*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{}) ([]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 GetCDSFromLCCC ¶
func GetCDSFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error)
GetCDSFromLCCC gets chaincode deployment spec from LCCC
func GetChaincodeDataFromLCCC ¶
func GetChaincodeDataFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (*ccprovider.ChaincodeData, error)
GetChaincodeDataFromLCCC gets chaincode data from LCCC given name
func HandleChaincodeStream ¶
func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, stream ccintf.ChaincodeStream) 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 SetupTestConfig ¶
func SetupTestConfig()
SetupTestConfig setup the config during test execution
func SetupTestLogging ¶
func SetupTestLogging()
SetupTestLogging setup the logging during test execution
Types ¶
type ChaincodeSupport ¶
type ChaincodeSupport struct {
// contains filtered or unexported fields
}
ChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.
func GetChain ¶
func GetChain() *ChaincodeSupport
GetChain returns the chaincode framework support object
func NewChaincodeSupport ¶
func NewChaincodeSupport(getPeerEndpoint func() (*pb.PeerEndpoint, error), userrunsCC bool, ccstartuptimeout time.Duration) *ChaincodeSupport
NewChaincodeSupport creates a new ChaincodeSupport instance
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) 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 responsbile for management of Peer's side of chaincode stream
func (*Handler) HandleMessage ¶
func (handler *Handler) HandleMessage(msg *pb.ChaincodeMessage) error
HandleMessage implementation of MessageHandler interface. Peer's handling of Chaincode messages.
type MessageHandler ¶
type MessageHandler interface { HandleMessage(msg *pb.ChaincodeMessage) error SendMessage(msg *pb.ChaincodeMessage) error }
MessageHandler interface for handling chaincode messages (common between Peer chaincode support and chaincode)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package shim provides APIs for the chaincode to access its state variables, transaction context and call other chaincodes.
|
Package shim provides APIs for the chaincode to access its state variables, transaction context and call other chaincodes. |