Documentation ¶
Index ¶
- Constants
- func Execute(ctxt context.Context, chain *ChaincodeSupport, t *pb.Transaction) ([]byte, error)
- func ExecuteTransactions(ctxt context.Context, cname ChainName, xacts []*pb.Transaction) ([]byte, []error)
- func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, stream pb.ChaincodeSupport_RegisterServer) error
- func SetupTestConfig()
- func SetupTestLogging()
- type ChainName
- type ChaincodeSupport
- func (chaincodeSupport *ChaincodeSupport) DeployChaincode(context context.Context, t *pb.Transaction) (*pb.ChaincodeDeploymentSpec, error)
- func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chaincode string, msg *pb.ChaincodeMessage, ...) (*pb.ChaincodeMessage, error)
- func (chaincodeSupport *ChaincodeSupport) GetExecutionContext(context context.Context, requestContext *pb.ChaincodeRequestContext) (*pb.ChaincodeExecutionContext, error)
- func (chaincodeSupport *ChaincodeSupport) LaunchChaincode(context context.Context, t *pb.Transaction) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
- func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
- type Config
- type DuplicateChaincodeHandlerError
- type Handler
- type MessageHandler
- type PeerChaincodeStream
Constants ¶
const ( // DefaultChain is the name of the default chain. DefaultChain ChainName = "default" // DevModeUserRunsChaincode property allows user to run chaincode in development environment DevModeUserRunsChaincode string = "dev" )
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(ctxt context.Context, chain *ChaincodeSupport, t *pb.Transaction) ([]byte, error)
Execute - execute transaction or a query
func ExecuteTransactions ¶
func ExecuteTransactions(ctxt context.Context, cname ChainName, xacts []*pb.Transaction) ([]byte, []error)
ExecuteTransactions - will execute transactions on the array one by one will return an array of errors one for each transaction. If the execution succeeded, array element will be nil. returns state hash
func HandleChaincodeStream ¶
func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, stream pb.ChaincodeSupport_RegisterServer) error
HandleChaincodeStream Main loop for handling the associated Chaincode stream
func SetupTestConfig ¶
func SetupTestConfig()
SetupTestConfig setup the config during test execution
func SetupTestLogging ¶
func SetupTestLogging()
SetupTestLogging setup the logging during test execution
Types ¶
type ChainName ¶
type ChainName string
ChainName is the name of the chain to which this chaincode support belongs to.
type ChaincodeSupport ¶
type ChaincodeSupport struct {
// contains filtered or unexported fields
}
ChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.
func GetChain ¶
func GetChain(name ChainName) *ChaincodeSupport
GetChain returns the chaincode support for a given chain
func NewChaincodeSupport ¶
func NewChaincodeSupport(chainname ChainName, getPeerEndpoint func() (*pb.PeerEndpoint, error), userrunsCC bool, ccstartuptimeout time.Duration, secHelper crypto.Peer) *ChaincodeSupport
NewChaincodeSupport creates a new ChaincodeSupport instance
func (*ChaincodeSupport) DeployChaincode ¶
func (chaincodeSupport *ChaincodeSupport) DeployChaincode(context context.Context, t *pb.Transaction) (*pb.ChaincodeDeploymentSpec, error)
DeployChaincode deploys the chaincode if not in development mode where user is running the chaincode.
func (*ChaincodeSupport) Execute ¶
func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chaincode string, msg *pb.ChaincodeMessage, timeout time.Duration, tx *pb.Transaction) (*pb.ChaincodeMessage, error)
Execute executes a transaction and waits for it to complete until a timeout value.
func (*ChaincodeSupport) GetExecutionContext ¶
func (chaincodeSupport *ChaincodeSupport) GetExecutionContext(context context.Context, requestContext *pb.ChaincodeRequestContext) (*pb.ChaincodeExecutionContext, error)
GetExecutionContext returns the execution context. DEPRECATED. TO be removed.
func (*ChaincodeSupport) LaunchChaincode ¶
func (chaincodeSupport *ChaincodeSupport) LaunchChaincode(context context.Context, t *pb.Transaction) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
LaunchChaincode 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.
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 PeerChaincodeStream FSM *fsm.FSM ChaincodeID *pb.ChaincodeID // contains filtered or unexported fields }
Handler responsbile for managment 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)
type PeerChaincodeStream ¶
type PeerChaincodeStream interface { Send(*pb.ChaincodeMessage) error Recv() (*pb.ChaincodeMessage, error) }
PeerChaincodeStream interface for stream between Peer and chaincode instance.