Version: v0.1.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2016 License: Apache-2.0 Imports: 21 Imported by: 140




View Source
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"


This section is empty.


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


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 Config

type Config struct {

Config the config wrapper structure

type DuplicateChaincodeHandlerError

type DuplicateChaincodeHandlerError struct {
	ChaincodeID *pb.ChaincodeID

DuplicateChaincodeHandlerError returned if attempt to register same chaincodeID while a stream already exists.

func (*DuplicateChaincodeHandlerError) Error

type Handler

type Handler struct {
	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.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL