Documentation ¶
Index ¶
- Constants
- Variables
- func Execute(ctxt context.Context, chain *ChaincodeSupport, t *pb.Transaction) ([]byte, []*pb.ChaincodeEvent, error)
- func ExecuteTransactions(ctxt context.Context, cname ChainName, xacts []*pb.Transaction) (succeededTXs []*pb.Transaction, stateHash []byte, ...)
- func ExecuteTransactions2(ctxt context.Context, cname ChainName, xacts []*pb.TransactionHandlingContext, ...) (succeededTXs []*pb.Transaction, err error)
- func GetChaincodePackageBytes(spec *pb.ChaincodeSpec) ([]byte, error)
- func RemoveChaincodeSupport(cName ChainName)
- func SetChaincodeSupport(cName ChainName, ccsp *ChaincodeSupport)
- func ValidateDeploymentSpec(txe *pb.TransactionHandlingContext, st ledger.TxExecStates, ...) error
- func WriteRuntimePackage(cds *pb.ChaincodeDeploymentSpec, clispec *config.ClientSpec) (*runtimeReader, error)
- type ChainName
- type ChaincodeSupport
- func GetChain(name ChainName) *ChaincodeSupport
- func GetDefaultChain() *ChaincodeSupport
- func GetSystemChain() *ChaincodeSupport
- func NewChaincodeSupport(chainname ChainName, nodeName string, srvSpec *config.ServerSpec, ...) *ChaincodeSupport
- func NewSystemChaincodeSupport(nodeName string, chainName ...ChainName) *ChaincodeSupport
- func (chaincodeSupport *ChaincodeSupport) DeployLaunch(ctx context.Context, ledger *ledger.Ledger, chaincode string, ...) (error, *chaincodeRTEnv)
- func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chrte *chaincodeRTEnv, ...) (*pb.ChaincodeMessage, error)
- func (chaincodeSupport *ChaincodeSupport) ExecuteLite(ctxt context.Context, chrte *chaincodeRTEnv, ttype pb.Transaction_Type, ...) (*pb.ChaincodeMessage, error)
- func (chaincodeSupport *ChaincodeSupport) FinalDeploy(chrte *chaincodeRTEnv, txe *pb.TransactionHandlingContext, ...) error
- func (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctx context.Context, stream ccintf.ChaincodeStream) error
- func (chaincodeSupport *ChaincodeSupport) Launch(ctx context.Context, ledger *ledger.Ledger, st ledger.TxExecStates, ...) (error, *chaincodeRTEnv)
- func (chaincodeSupport *ChaincodeSupport) Launch2(ctx context.Context, ledger *ledger.Ledger, chaincode string, ...) (error, *chaincodeRTEnv)
- func (chaincodeSupport *ChaincodeSupport) Name() string
- func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
- func (chaincodeSupport *ChaincodeSupport) ReleaseLedger(l *ledger.Ledger) error
- func (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, netTag string, cds *pb.ChaincodeDeploymentSpec) error
- func (chaincodeSupport *ChaincodeSupport) UserRunsCC() bool
- type ExecuteResult
- type Handler
- type MessageHandler
Constants ¶
const ( // DefaultChain is the name of the default chain. DefaultChain ChainName = "default" SystemChain ChainName = "syscc" // DevModeUserRunsChaincode property allows user to run chaincode in development environment DevModeUserRunsChaincode string = "dev" NetworkModeChaincode string = "net" )
Variables ¶
var CCHandlingErr_RCMain = fmt.Errorf("Chaincode handling have a racing condiction")
var CCHandlingErr_RCWrite = fmt.Errorf("Chaincode handling have a racing condiction in writting states")
var ReservedCCName = map[string]bool{/* contains filtered or unexported fields */}
used to filter some chaincode name from external accessing
Functions ¶
func Execute ¶
func Execute(ctxt context.Context, chain *ChaincodeSupport, t *pb.Transaction) ([]byte, []*pb.ChaincodeEvent, error)
Execute - execute transaction or a query This method has been deprecated: chaincode being executed could not obtain an repeatable execution timestamp, which may lead to the generated state being unstable
func ExecuteTransactions ¶
func ExecuteTransactions(ctxt context.Context, cname ChainName, xacts []*pb.Transaction) (succeededTXs []*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 YA-fabric: ExecuteTransactions is badly designed, the events has been truncated to first one and should be deprecated later
func ExecuteTransactions2 ¶
func ExecuteTransactions2(ctxt context.Context, cname ChainName, xacts []*pb.TransactionHandlingContext, execTime time.Time, agent *ledger.TxEvaluateAndCommit) (succeededTXs []*pb.Transaction, err error)
The new exec entry for YA-fabric, which evaluating a series of txs (with handling context) in sequence and prepare for a TxEvaluateAndCommit, it also mutate the incoming transacion handling context, with an execution timestamp being specified the success tx will be returned, respecting the expected behavior in ledger's commitTxBatch
func GetChaincodePackageBytes ¶
func GetChaincodePackageBytes(spec *pb.ChaincodeSpec) ([]byte, error)
GetChaincodePackageBytes creates bytes for docker container generation using the supplied chaincode specification
func RemoveChaincodeSupport ¶
func RemoveChaincodeSupport(cName ChainName)
func SetChaincodeSupport ¶
func SetChaincodeSupport(cName ChainName, ccsp *ChaincodeSupport)
func ValidateDeploymentSpec ¶
func ValidateDeploymentSpec(txe *pb.TransactionHandlingContext, st ledger.TxExecStates, ledger *ledger.Ledger) error
func WriteRuntimePackage ¶
func WriteRuntimePackage(cds *pb.ChaincodeDeploymentSpec, clispec *config.ClientSpec) (*runtimeReader, error)
Generate a package (in Writer) for (docker) controller
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 GetDefaultChain ¶
func GetDefaultChain() *ChaincodeSupport
func GetSystemChain ¶
func GetSystemChain() *ChaincodeSupport
func NewChaincodeSupport ¶
func NewChaincodeSupport(chainname ChainName, nodeName string, srvSpec *config.ServerSpec, userrunsCC bool) *ChaincodeSupport
NewChaincodeSupport creates a new ChaincodeSupport instance
func NewSystemChaincodeSupport ¶
func NewSystemChaincodeSupport(nodeName string, chainName ...ChainName) *ChaincodeSupport
func (*ChaincodeSupport) DeployLaunch ¶
func (chaincodeSupport *ChaincodeSupport) DeployLaunch(ctx context.Context, ledger *ledger.Ledger, chaincode string, cds *pb.ChaincodeDeploymentSpec) (error, *chaincodeRTEnv)
func (*ChaincodeSupport) Execute ¶
func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chrte *chaincodeRTEnv, txe *pb.TransactionHandlingContext, outstate ledger.TxExecStates) (*pb.ChaincodeMessage, error)
Execute executes a transaction and waits for it to complete until a timeout value.
func (*ChaincodeSupport) ExecuteLite ¶
func (chaincodeSupport *ChaincodeSupport) ExecuteLite(ctxt context.Context, chrte *chaincodeRTEnv, ttype pb.Transaction_Type, input *pb.ChaincodeInput, outstate ledger.TxExecStates) (*pb.ChaincodeMessage, error)
Executelite executes with minimal data requirement, can used for internal testing, syscc and some other cases this method also omit the limit of exectimeout, and CAN NOT be run concurrently
func (*ChaincodeSupport) FinalDeploy ¶
func (chaincodeSupport *ChaincodeSupport) FinalDeploy(chrte *chaincodeRTEnv, txe *pb.TransactionHandlingContext, outstate ledger.TxExecStates) error
func (*ChaincodeSupport) HandleChaincodeStream ¶
func (chaincodeSupport *ChaincodeSupport) HandleChaincodeStream(ctx context.Context, stream ccintf.ChaincodeStream) error
func (*ChaincodeSupport) Launch ¶
func (chaincodeSupport *ChaincodeSupport) Launch(ctx context.Context, ledger *ledger.Ledger, st ledger.TxExecStates, chaincode string) (error, *chaincodeRTEnv)
func (*ChaincodeSupport) Launch2 ¶
func (chaincodeSupport *ChaincodeSupport) Launch2(ctx context.Context, ledger *ledger.Ledger, chaincode string, getcds func() (*pb.ChaincodeDeploymentSpec, *pb.Transaction, error)) (error, *chaincodeRTEnv)
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) Name ¶
func (chaincodeSupport *ChaincodeSupport) Name() string
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. registerHandler implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream It call the main loop in handler for handling the associated Chaincode stream
func (*ChaincodeSupport) ReleaseLedger ¶
func (chaincodeSupport *ChaincodeSupport) ReleaseLedger(l *ledger.Ledger) error
func (*ChaincodeSupport) Stop ¶
func (chaincodeSupport *ChaincodeSupport) Stop(context context.Context, netTag string, cds *pb.ChaincodeDeploymentSpec) error
Stop stops a chaincode if running
func (*ChaincodeSupport) UserRunsCC ¶
func (chaincodeSupport *ChaincodeSupport) UserRunsCC() bool
type ExecuteResult ¶
type ExecuteResult struct { State ledger.TxExecStates Events []*pb.ChaincodeEvent Resp []byte }
func Execute2 ¶
func Execute2(ctxt context.Context, ledgerObj *ledger.Ledger, chain *ChaincodeSupport, te *pb.TransactionHandlingContext, texec ledger.TxExecStates) (*ExecuteResult, error)
Execute2 - like legacy execute, but not relay the global ledger object and supposed the transaction has be make pre-exec
type Handler ¶
type Handler struct { sync.RWMutex FSM *fsm.FSM ChaincodeID *pb.ChaincodeID Ledger *ledger.Ledger ShimVersion int // contains filtered or unexported fields }
Handler responsbile for management of Peer's side of chaincode stream
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. |