chaincode

package
v0.0.0-...-1d5e6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

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"
)

Variables

This section is empty.

Functions

func Execute

func Execute(ctxt context.Context, chain *ChaincodeSupport, t *pb.Transaction) ([]byte, *pb.ChaincodeEvent, error)

Execute - execute transaction or a query

func ExecuteTransactions

func ExecuteTransactions(ctxt context.Context, cname ChainName, xacts []*pb.Transaction) (stateHash []byte, ccevents []*pb.ChaincodeEvent, txerrs []error, err 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 []byte of state hash or error

func HandleChaincodeStream

func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, stream ccintf.ChaincodeStream) 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) Deploy

func (chaincodeSupport *ChaincodeSupport) Deploy(context context.Context, t *pb.Transaction) (*pb.ChaincodeDeploymentSpec, error)

Deploy 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) 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, t *pb.Transaction) (*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, cds *pb.ChaincodeDeploymentSpec) error

Stop stops a chaincode if running

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 {
	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)

Directories

Path Synopsis
car
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.

Jump to

Keyboard shortcuts

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