Documentation
¶
Index ¶
- Constants
- func DeploySysCC(chainID string, syscc *SystemChaincode) error
- func DeploySysCCs(chainID string)
- func Execute(ctxt context.Context, chainID string, txid string, prop *pb.Proposal, ...) ([]byte, *pb.ChaincodeEvent, error)
- func ExecuteChaincode(ctxt context.Context, chainID string, txid string, prop *pb.Proposal, ...) ([]byte, *pb.ChaincodeEvent, error)
- func GetCDSFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, ...) ([]byte, error)
- func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, ...) error
- func RegisterSysCC(syscc *SystemChaincode) error
- func RegisterSysCCs()
- func SetupTestConfig()
- func SetupTestLogging()
- type AlreadyRegisteredErr
- type ChaincodeNotFoundErr
- type ChaincodeSupport
- func (chaincodeSupport *ChaincodeSupport) Deploy(context context.Context, chainID string, cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)
- func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chainID string, chaincode string, ...) (*pb.ChaincodeMessage, error)
- func (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error
- func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, chainID string, txid string, prop *pb.Proposal, ...) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
- func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
- func (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, chainID string, cds *pb.ChaincodeDeploymentSpec) error
- type Config
- type DuplicateChaincodeHandlerError
- type ExistsErr
- type Handler
- type InvalidArgsErr
- type InvalidArgsLenErr
- type InvalidChainNameErr
- type InvalidChaincodeNameErr
- type InvalidDeploymentSpecErr
- type InvalidFunctionErr
- type LifeCycleSysCC
- type MarshallErr
- type MessageHandler
- type SystemChaincode
- type TXExistsErr
- type TXNotFoundErr
Constants ¶
const ( // DevModeUserRunsChaincode property allows user to run chaincode in development environment DevModeUserRunsChaincode string = "dev" //TXSimulatorKey is used to attach ledger simulation context TXSimulatorKey string = "txsimulatorkey" )
const ( //CHAINCODETABLE prefix for chaincode tables CHAINCODETABLE = "chaincodes" //DEPLOY deploy command DEPLOY = "deploy" //UPGRADE upgrade chaincode UPGRADE = "upgrade" //GETCCINFO get chaincode GETCCINFO = "getid" //GETDEPSPEC get ChaincodeDeploymentSpec GETDEPSPEC = "getdepspec" )
Variables ¶
This section is empty.
Functions ¶
func DeploySysCC ¶
func DeploySysCC(chainID string, syscc *SystemChaincode) error
DeploySysCC deploys the given system chaincode on a chain
func DeploySysCCs ¶
func DeploySysCCs(chainID string)
DeploySysCCs is the hook for system chaincodes where system chaincodes are registered with the fabric note the chaincode must still be deployed and launched like a user chaincode will be
func Execute ¶
func Execute(ctxt context.Context, chainID string, txid string, prop *pb.Proposal, spec interface{}) ([]byte, *pb.ChaincodeEvent, error)
Execute - execute proposal
func ExecuteChaincode ¶
func ExecuteChaincode(ctxt context.Context, chainID string, txid string, prop *pb.Proposal, ccname string, args [][]byte) ([]byte, *pb.ChaincodeEvent, error)
ExecuteChaincode executes a given chaincode given chaincode name and arguments
func GetCDSFromLCCC ¶
func GetCDSFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error)
GetCDSFromLCCC gets chaincode deployment spec from LCCC
func HandleChaincodeStream ¶
func HandleChaincodeStream(chaincodeSupport *ChaincodeSupport, ctxt context.Context, stream ccintf.ChaincodeStream) error
HandleChaincodeStream Main loop for handling the associated Chaincode stream
func RegisterSysCC ¶
func RegisterSysCC(syscc *SystemChaincode) error
RegisterSysCC registers the given system chaincode with the peer
func RegisterSysCCs ¶
func RegisterSysCCs()
RegisterSysCCs is the hook for system chaincodes where system chaincodes are registered with the fabric note the chaincode must still be deployed and launched like a user chaincode will be
func SetupTestConfig ¶
func SetupTestConfig()
SetupTestConfig setup the config during test execution
func SetupTestLogging ¶
func SetupTestLogging()
SetupTestLogging setup the logging during test execution
Types ¶
type AlreadyRegisteredErr ¶
type AlreadyRegisteredErr string
AlreadyRegisteredErr Already registered error
func (AlreadyRegisteredErr) Error ¶
func (f AlreadyRegisteredErr) Error() string
type ChaincodeNotFoundErr ¶
type ChaincodeNotFoundErr string
func (ChaincodeNotFoundErr) Error ¶
func (t ChaincodeNotFoundErr) Error() string
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
func NewChaincodeSupport ¶
func NewChaincodeSupport(getPeerEndpoint func() (*pb.PeerEndpoint, error), userrunsCC bool, ccstartuptimeout time.Duration) *ChaincodeSupport
NewChaincodeSupport creates a new ChaincodeSupport instance
func (*ChaincodeSupport) Deploy ¶
func (chaincodeSupport *ChaincodeSupport) Deploy(context context.Context, chainID string, cds *pb.ChaincodeDeploymentSpec) (*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, chainID string, chaincode string, msg *pb.ChaincodeMessage, timeout time.Duration, prop *pb.Proposal) (*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, chainID string, txid string, prop *pb.Proposal, 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, chainID string, 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 InvalidArgsErr ¶
type InvalidArgsErr int
InvalidArgsErr invalid arguments error
func (InvalidArgsErr) Error ¶
func (i InvalidArgsErr) Error() string
type InvalidArgsLenErr ¶
type InvalidArgsLenErr int
InvalidArgsLenErr invalid arguments length error
func (InvalidArgsLenErr) Error ¶
func (i InvalidArgsLenErr) Error() string
type InvalidChainNameErr ¶
type InvalidChainNameErr string
InvalidChainNameErr invalid chain name error
func (InvalidChainNameErr) Error ¶
func (f InvalidChainNameErr) Error() string
type InvalidChaincodeNameErr ¶
type InvalidChaincodeNameErr string
InvalidChaincodeNameErr invalid chaincode name error
func (InvalidChaincodeNameErr) Error ¶
func (f InvalidChaincodeNameErr) Error() string
type InvalidDeploymentSpecErr ¶
type InvalidDeploymentSpecErr string
InvalidDeploymentSpecErr invalide chaincode deployment spec error
func (InvalidDeploymentSpecErr) Error ¶
func (f InvalidDeploymentSpecErr) Error() string
type InvalidFunctionErr ¶
type InvalidFunctionErr string
InvalidFunctionErr invalid function error
func (InvalidFunctionErr) Error ¶
func (f InvalidFunctionErr) Error() string
type LifeCycleSysCC ¶
type LifeCycleSysCC struct {
}
LifeCycleSysCC implements chaincode lifecycle and policies aroud it
func (*LifeCycleSysCC) Init ¶
func (lccc *LifeCycleSysCC) Init(stub shim.ChaincodeStubInterface) ([]byte, error)
Init does nothing
func (*LifeCycleSysCC) Invoke ¶
func (lccc *LifeCycleSysCC) Invoke(stub shim.ChaincodeStubInterface) ([]byte, error)
Invoke implements lifecycle functions "deploy", "start", "stop", "upgrade". Deploy's arguments - {[]byte("deploy"), []byte(<chainname>), <unmarshalled pb.ChaincodeDeploymentSpec>}
Invoke also implements some query-like functions Get chaincode arguments - {[]byte("getid"), []byte(<chainname>), []byte(<chaincodename>)}
type MarshallErr ¶
type MarshallErr string
MarshallErr error marshaling/unmarshalling
func (MarshallErr) Error ¶
func (m MarshallErr) Error() string
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 SystemChaincode ¶
type SystemChaincode struct {
// Enabled a convenient switch to enable/disable system chaincode without
// having to remove entry from importsysccs.go
Enabled bool
//Unique name of the system chaincode
Name string
//Path to the system chaincode; currently not used
Path string
//InitArgs initialization arguments to startup the system chaincode
InitArgs [][]byte
// Chaincode is the actual chaincode object
Chaincode shim.Chaincode
}
SystemChaincode defines the metadata needed to initialize system chaincode when the fabric comes up. SystemChaincodes are installed by adding an entry in importsysccs.go
type TXExistsErr ¶
type TXExistsErr string
TXExistsErr transaction exists error
func (TXExistsErr) Error ¶
func (t TXExistsErr) Error() string
type TXNotFoundErr ¶
type TXNotFoundErr string
TXNotFoundErr transaction not found error
func (TXNotFoundErr) Error ¶
func (t TXNotFoundErr) Error() string
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. |