Documentation
¶
Index ¶
- Constants
- func IsDevMode() bool
- func NewTxKey(channelID, txID string) string
- func ParseName(ccName string) *sysccprovider.ChaincodeInstance
- type ACLProvider
- type ActiveTransactions
- type CCProviderImpl
- func (c *CCProviderImpl) Execute(ctxt context.Context, cccid *ccprovider.CCContext, ...) (*pb.Response, *pb.ChaincodeEvent, error)
- func (c *CCProviderImpl) ExecuteChaincode(ctxt context.Context, cccid *ccprovider.CCContext, args [][]byte) (*pb.Response, *pb.ChaincodeEvent, error)
- func (c *CCProviderImpl) GetContext(ledger ledger.PeerLedger, txid string) (context.Context, ledger.TxSimulator, error)
- func (c *CCProviderImpl) Stop(ctxt context.Context, cccid *ccprovider.CCContext, ...) error
- type CertGenerator
- type ChaincodeDefinitionGetter
- type ChaincodeSupport
- func (cs *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, ...) (*pb.Response, *pb.ChaincodeEvent, error)
- func (cs *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error
- func (cs *ChaincodeSupport) Invoke(ctxt context.Context, cccid *ccprovider.CCContext, ...) (*pb.ChaincodeMessage, error)
- func (cs *ChaincodeSupport) Launch(ctx context.Context, cccid *ccprovider.CCContext, ...) error
- func (cs *ChaincodeSupport) Register(stream pb.ChaincodeSupport_RegisterServer) error
- func (cs *ChaincodeSupport) Stop(ctx context.Context, cccid *ccprovider.CCContext, ...) error
- type CheckInstantiationPolicyFunc
- type Config
- type ContainerRuntime
- type ContextRegistry
- type Executor
- type Handler
- func (h *Handler) ChaincodeName() string
- func (h *Handler) Close()
- func (h *Handler) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, ...) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleDelState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleGetHistoryForKey(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleGetQueryResult(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleGetStateByRange(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleInvokeChaincode(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandlePutState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleQueryStateClose(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleQueryStateNext(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
- func (h *Handler) HandleRegister(msg *pb.ChaincodeMessage)
- func (h *Handler) HandleTransaction(msg *pb.ChaincodeMessage, delegate handleFunc)
- func (h *Handler) Notify(msg *pb.ChaincodeMessage)
- func (h *Handler) ProcessStream(stream ccintf.ChaincodeStream) error
- func (h *Handler) State() State
- type HandlerRegistry
- func (r *HandlerRegistry) Deregister(cname string) error
- func (r *HandlerRegistry) Failed(cname string, err error)
- func (r *HandlerRegistry) Handler(cname string) *Handler
- func (r *HandlerRegistry) HasLaunched(chaincode string) bool
- func (r *HandlerRegistry) Launching(cname string) (*LaunchState, error)
- func (r *HandlerRegistry) Ready(cname string)
- func (r *HandlerRegistry) Register(h *Handler) error
- type InstantiationPolicyChecker
- type Invoker
- type LaunchConfig
- type LaunchRegistry
- type LaunchState
- type Launcher
- type LedgerGetter
- type Lifecycle
- func (l *Lifecycle) GetChaincodeDefinition(ctx context.Context, txid string, signedProp *pb.SignedProposal, ...) (ccprovider.ChaincodeDefinition, error)
- func (l *Lifecycle) GetChaincodeDeploymentSpec(ctx context.Context, txid string, signedProp *pb.SignedProposal, ...) (*pb.ChaincodeDeploymentSpec, error)
- type MessageHandler
- type PackageProvider
- type PendingQueryResult
- type Processor
- type QueryResponseBuilder
- type QueryResponseGenerator
- type Registry
- type Runtime
- type RuntimeLauncher
- type State
- type SystemCCProvider
- type TransactionContext
- func (t *TransactionContext) CleanupQueryContext(queryID string)
- func (t *TransactionContext) CloseQueryIterators()
- func (t *TransactionContext) GetPendingQueryResult(queryID string) *PendingQueryResult
- func (t *TransactionContext) GetQueryIterator(queryID string) commonledger.ResultsIterator
- func (t *TransactionContext) InitializeQueryContext(queryID string, iter commonledger.ResultsIterator)
- type TransactionContexts
- func (c *TransactionContexts) Close()
- func (c *TransactionContexts) Create(ctx context.Context, chainID, txID string, signedProp *pb.SignedProposal, ...) (*TransactionContext, error)
- func (c *TransactionContexts) Delete(chainID, txID string)
- func (c *TransactionContexts) Get(chainID, txID string) *TransactionContext
- type TransactionRegistry
- type UUIDGenerator
- type UUIDGeneratorFunc
Constants ¶
const ( // Mutual TLS auth client key and cert paths in the chaincode container TLSClientKeyPath string = "/etc/hyperledger/fabric/client.key" TLSClientCertPath string = "/etc/hyperledger/fabric/client.crt" TLSClientRootCertPath string = "/etc/hyperledger/fabric/peer.crt" )
const ( // TXSimulatorKey is the context key used to provide a ledger.TxSimulator // from the endorser to the chaincode. TXSimulatorKey key = "txsimulatorkey" // HistoryQueryExecutorKey is the context key used to provide a // ledger.HistoryQueryExecutor from the endorser to the chaincode. HistoryQueryExecutorKey key = "historyqueryexecutorkey" )
const DevModeUserRunsChaincode string = "dev"
DevModeUserRunsChaincode enables chaincode execution in a development environment
Variables ¶
This section is empty.
Functions ¶
func IsDevMode ¶
func IsDevMode() bool
IsDevMode returns true if the peer was configured with development-mode enabled.
func ParseName ¶ added in v1.2.0
func ParseName(ccName string) *sysccprovider.ChaincodeInstance
ParseName parses a chaincode name into a ChaincodeInstance. The name should be of the form "chaincode-name:version/channel-name" with optional elements.
Types ¶
type ACLProvider ¶ added in v1.2.0
An ACLProvider performs access control checks when invoking chaincode.
type ActiveTransactions ¶ added in v1.2.0
type ActiveTransactions struct {
// contains filtered or unexported fields
}
func NewActiveTransactions ¶ added in v1.2.0
func NewActiveTransactions() *ActiveTransactions
func (*ActiveTransactions) Add ¶ added in v1.2.0
func (a *ActiveTransactions) Add(channelID, txID string) bool
func (*ActiveTransactions) Remove ¶ added in v1.2.0
func (a *ActiveTransactions) Remove(channelID, txID string)
type CCProviderImpl ¶ added in v1.2.0
type CCProviderImpl struct {
// contains filtered or unexported fields
}
ccProviderImpl is an implementation of the ccprovider.ChaincodeProvider interface
func NewProvider ¶ added in v1.2.0
func NewProvider(cs *ChaincodeSupport) *CCProviderImpl
func (*CCProviderImpl) Execute ¶ added in v1.2.0
func (c *CCProviderImpl) Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.Response, *pb.ChaincodeEvent, error)
Execute executes the chaincode given context and spec (invocation or deploy)
func (*CCProviderImpl) ExecuteChaincode ¶ added in v1.2.0
func (c *CCProviderImpl) ExecuteChaincode(ctxt context.Context, cccid *ccprovider.CCContext, args [][]byte) (*pb.Response, *pb.ChaincodeEvent, error)
ExecuteChaincode executes the chaincode specified in the context with the specified arguments
func (*CCProviderImpl) GetContext ¶ added in v1.2.0
func (c *CCProviderImpl) GetContext(ledger ledger.PeerLedger, txid string) (context.Context, ledger.TxSimulator, error)
GetContext returns a context for the supplied ledger, with the appropriate tx simulator
func (*CCProviderImpl) Stop ¶ added in v1.2.0
func (c *CCProviderImpl) Stop(ctxt context.Context, cccid *ccprovider.CCContext, spec *pb.ChaincodeDeploymentSpec) error
Stop stops the chaincode given context and spec
type CertGenerator ¶ added in v1.2.0
type CertGenerator interface {
// Generate returns a certificate and private key and associates
// the hash of the certificates with the given chaincode name
Generate(ccName string) (*accesscontrol.CertAndPrivKeyPair, error)
}
CertGenerator generates client certificates for chaincode.
type ChaincodeDefinitionGetter ¶ added in v1.2.0
type ChaincodeDefinitionGetter interface {
GetChaincodeDefinition(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (ccprovider.ChaincodeDefinition, error)
}
ChaincodeDefinitionGetter is responsible for retrieving a chaincode definition from the system. The definition is used by the InstantiationPolicyChecker.
type ChaincodeSupport ¶
type ChaincodeSupport struct {
Keepalive time.Duration
ExecuteTimeout time.Duration
UserRunsCC bool
Runtime Runtime
ACLProvider ACLProvider
HandlerRegistry *HandlerRegistry
Launcher Launcher
// contains filtered or unexported fields
}
ChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.
func NewChaincodeSupport ¶
func NewChaincodeSupport( config *Config, peerAddress string, userRunsCC bool, caCert []byte, certGenerator CertGenerator, packageProvider PackageProvider, aclProvider ACLProvider, processor Processor, sccp sysccprovider.SystemChaincodeProvider, ) *ChaincodeSupport
NewChaincodeSupport creates a new ChaincodeSupport instance.
func (*ChaincodeSupport) Execute ¶
func (cs *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.Response, *pb.ChaincodeEvent, error)
Execute invokes chaincode and returns the original response.
func (*ChaincodeSupport) HandleChaincodeStream ¶
func (cs *ChaincodeSupport) HandleChaincodeStream(ctxt context.Context, stream ccintf.ChaincodeStream) error
HandleChaincodeStream implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream
func (*ChaincodeSupport) Invoke ¶ added in v1.2.0
func (cs *ChaincodeSupport) Invoke(ctxt context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeMessage, error)
Invoke will invoke chaincode and return the message containing the response. The chaincode will be launched if it is not already running.
func (*ChaincodeSupport) Launch ¶
func (cs *ChaincodeSupport) Launch(ctx context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) error
Launch starts executing chaincode if it is not already running. This method blocks until the peer side handler gets into ready state or encounters a fatal error. If the chaincode is already running, it simply returns.
func (*ChaincodeSupport) Register ¶
func (cs *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 (cs *ChaincodeSupport) Stop(ctx context.