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 ¶
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 ¶
An ACLProvider performs access control checks when invoking chaincode.
type ActiveTransactions ¶
type ActiveTransactions struct {
// contains filtered or unexported fields
}
func NewActiveTransactions ¶
func NewActiveTransactions() *ActiveTransactions
func (*ActiveTransactions) Add ¶
func (a *ActiveTransactions) Add(channelID, txID string) bool
func (*ActiveTransactions) Remove ¶
func (a *ActiveTransactions) Remove(channelID, txID string)
type CCProviderImpl ¶
type CCProviderImpl struct {
// contains filtered or unexported fields
}
ccProviderImpl is an implementation of the ccprovider.ChaincodeProvider interface
func NewProvider ¶
func NewProvider(cs *ChaincodeSupport) *CCProviderImpl
func (*CCProviderImpl) Execute ¶
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 ¶
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 ¶
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 ¶
func (c *CCProviderImpl) Stop(ctxt context.Context, cccid *ccprovider.CCContext, spec *pb.ChaincodeDeploymentSpec) error
Stop stops the chaincode given context and spec
type CertGenerator ¶
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 ¶
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 ¶
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.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error
Stop stops a chaincode if running.
type CheckInstantiationPolicyFunc ¶
type CheckInstantiationPolicyFunc func(name, version string, cd *ccprovider.ChaincodeData) error
Adapter from function to InstantiationPolicyChecker interface.
func (CheckInstantiationPolicyFunc) CheckInstantiationPolicy ¶
func (c CheckInstantiationPolicyFunc) CheckInstantiationPolicy(name, version string, cd *ccprovider.ChaincodeData) error
type Config ¶
type Config struct { TLSEnabled bool Keepalive time.Duration ExecuteTimeout time.Duration StartupTimeout time.Duration LogFormat string LogLevel string ShimLogLevel string }
func GlobalConfig ¶
func GlobalConfig() *Config
type ContainerRuntime ¶
type ContainerRuntime struct { CertGenerator CertGenerator Processor Processor CACert []byte CommonEnv []string PeerAddress string }
ContainerRuntime is responsible for managing containerized chaincode.
func (*ContainerRuntime) LaunchConfig ¶
func (c *ContainerRuntime) LaunchConfig(cname string, ccType pb.ChaincodeSpec_Type) (*LaunchConfig, error)
LaunchConfig creates the LaunchConfig for chaincode running in a container.
func (*ContainerRuntime) Start ¶
func (c *ContainerRuntime) Start(ctxt context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error
Start launches chaincode in a runtime environment.
func (*ContainerRuntime) Stop ¶
func (c *ContainerRuntime) Stop(ctxt context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error
Stop terminates chaincode and its container runtime environment.
type ContextRegistry ¶
type ContextRegistry interface { Create(ctx context.Context, chainID, txID string, signedProp *pb.SignedProposal, proposal *pb.Proposal) (*TransactionContext, error) Get(chainID, txID string) *TransactionContext Delete(chainID, txID string) Close() }
A ContextRegistry is responsible for managing transaction contexts.
type Executor ¶
type Executor interface {
Execute(ctxt context.Context, cccid *ccprovider.CCContext, cis ccprovider.ChaincodeSpecGetter) (*pb.Response, *pb.ChaincodeEvent, error)
}
Executor is used to invoke chaincode.
type Handler ¶
type Handler struct { // Keepalive specifies the interval at which keep-alive messages are sent. Keepalive time.Duration // SystemCCVersion specifies the current system chaincode version SystemCCVersion string // DefinitionGetter is used to retrieve the chaincode definition from the // Lifecycle System Chaincode. DefinitionGetter ChaincodeDefinitionGetter // Invoker is used to invoke chaincode. Invoker Invoker // Registry is used to track active handlers. Registry Registry // ACLProvider is used to check if a chaincode invocation should be allowed. ACLProvider ACLProvider // TXContexts is a collection of TransactionContext instances // that are accessed by channel name and transaction ID. TXContexts ContextRegistry // activeTransactions holds active transaction identifiers. ActiveTransactions TransactionRegistry // SystemCCProvider provides access to system chaincode metadata SystemCCProvider SystemCCProvider // InstantiationPolicyChecker is used to evaluate the chaincode instantiation policies. InstantiationPolicyChecker InstantiationPolicyChecker // QueryResponeBuilder is used to build query responses QueryResponseBuilder QueryResponseBuilder // LedgerGetter is used to get the ledger associated with a channel LedgerGetter LedgerGetter // UUIDGenerator is used to generate UUIDs UUIDGenerator UUIDGenerator // contains filtered or unexported fields }
Handler implements the peer side of the chaincode stream.
func (*Handler) ChaincodeName ¶
func (*Handler) Execute ¶
func (h *Handler) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error)
func (*Handler) HandleDelState ¶
func (h *Handler) HandleDelState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
func (*Handler) HandleGetHistoryForKey ¶
func (h *Handler) HandleGetHistoryForKey(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles query to ledger history db
func (*Handler) HandleGetQueryResult ¶
func (h *Handler) HandleGetQueryResult(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles query to ledger to execute query state
func (*Handler) HandleGetState ¶
func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles query to ledger to get state
func (*Handler) HandleGetStateByRange ¶
func (h *Handler) HandleGetStateByRange(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles query to ledger to rage query state
func (*Handler) HandleInvokeChaincode ¶
func (h *Handler) HandleInvokeChaincode(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles requests that modify ledger state
func (*Handler) HandlePutState ¶
func (h *Handler) HandlePutState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
func (*Handler) HandleQueryStateClose ¶
func (h *Handler) HandleQueryStateClose(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles the closing of a state iterator
func (*Handler) HandleQueryStateNext ¶
func (h *Handler) HandleQueryStateNext(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error)
Handles query to ledger for query state next
func (*Handler) HandleRegister ¶
func (h *Handler) HandleRegister(msg *pb.ChaincodeMessage)
handleRegister is invoked when chaincode tries to register.
func (*Handler) HandleTransaction ¶
func (h *Handler) HandleTransaction(msg *pb.ChaincodeMessage, delegate handleFunc)
HandleTransaction is a middleware function that obtains and verifies a transaction context prior to forwarding the message to the provided delegate. Response messages returened by the delegate are sent to the chat stream. Any errors returned by the delegate are packaged as chaincode error messages.
func (*Handler) Notify ¶
func (h *Handler) Notify(msg *pb.ChaincodeMessage)
func (*Handler) ProcessStream ¶
func (h *Handler) ProcessStream(stream ccintf.ChaincodeStream) error
type HandlerRegistry ¶
type HandlerRegistry struct {
// contains filtered or unexported fields
}
HandlerRegistry maintains chaincode Handler instances.
func NewHandlerRegistry ¶
func NewHandlerRegistry(allowUnsolicitedRegistration bool) *HandlerRegistry
NewHandlerRegistry constructs a HandlerRegistry.
func (*HandlerRegistry) Deregister ¶
func (r *HandlerRegistry) Deregister(cname string) error
Deregister clears references to state associated specified chaincode. As part of the cleanup, it closes the handler so it can cleanup any state. If the registry does not contain the provided handler, an error is returned.
func (*HandlerRegistry) Failed ¶
func (r *HandlerRegistry) Failed(cname string, err error)
Failed indicates that registration of a launched chaincode has failed.
func (*HandlerRegistry) Handler ¶
func (r *HandlerRegistry) Handler(cname string) *Handler
Handler retrieves the handler for a chaincode instance.
func (*HandlerRegistry) HasLaunched ¶
func (r *HandlerRegistry) HasLaunched(chaincode string) bool
HasLaunched returns true if the named chaincode is launching or running.
func (*HandlerRegistry) Launching ¶
func (r *HandlerRegistry) Launching(cname string) (*LaunchState, error)
Launching indicates that chaincode is being launched. The LaunchState that is returned provides mechanisms to determine when the operation has completed and whether or not it failed. An error will be returned if chaincode launch processing has already been initated.
func (*HandlerRegistry) Ready ¶
func (r *HandlerRegistry) Ready(cname string)
Ready indicates that the chaincode registration has completed and the READY response has been sent to the chaincode.
func (*HandlerRegistry) Register ¶
func (r *HandlerRegistry) Register(h *Handler) error
Register adds a chaincode handler to the registry. An error will be returned if a handler is already registered for the chaincode. An error will also be returned if the chaincode has not already been "launched", and unsolicited registration is not allowed.
type InstantiationPolicyChecker ¶
type InstantiationPolicyChecker interface {
CheckInstantiationPolicy(name, version string, cd *ccprovider.ChaincodeData) error
}
InstantiationPolicyChecker is used to evaluate instantiation policies.
type Invoker ¶
type Invoker interface {
Invoke(ctxt context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeMessage, error)
}
An Invoker invokes chaincode.
type LaunchConfig ¶
LaunchConfig holds chaincode launch arguments, environment variables, and files.
func (*LaunchConfig) String ¶
func (lc *LaunchConfig) String() string
type LaunchRegistry ¶
type LaunchRegistry interface { Launching(cname string) (*LaunchState, error) Deregister(cname string) error }
LaunchRegistry tracks launching chaincode instances.
type LaunchState ¶
type LaunchState struct {
// contains filtered or unexported fields
}
func NewLaunchState ¶
func NewLaunchState() *LaunchState
func (*LaunchState) Done ¶
func (l *LaunchState) Done() <-chan struct{}
func (*LaunchState) Err ¶
func (l *LaunchState) Err() error
func (*LaunchState) Notify ¶
func (l *LaunchState) Notify(err error)
type Launcher ¶
type Launcher interface {
Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) error
}
Launcher is used to launch chaincode runtimes.
type LedgerGetter ¶
type LedgerGetter interface {
GetLedger(cid string) ledger.PeerLedger
}
LedgerGetter is used to get ledgers for chaincode.
type Lifecycle ¶
type Lifecycle struct {
Executor Executor
}
Lifecycle provides methods to invoke the lifecycle system chaincode.
func (*Lifecycle) GetChaincodeDefinition ¶
func (l *Lifecycle) GetChaincodeDefinition( ctx context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string, ) (ccprovider.ChaincodeDefinition, error)
GetChaincodeDefinition returns a ccprovider.ChaincodeDefinition for the chaincode associated with the provided channel and name.
func (*Lifecycle) GetChaincodeDeploymentSpec ¶
func (l *Lifecycle) GetChaincodeDeploymentSpec( ctx context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string, ) (*pb.ChaincodeDeploymentSpec, error)
GetChaincodeDeploymentSpec retrieves a chaincode deployment spec for the specified chaincode.
type MessageHandler ¶
type MessageHandler interface {
Handle(*pb.ChaincodeMessage, *TransactionContext) (*pb.ChaincodeMessage, error)
}
type PackageProvider ¶
type PackageProvider interface {
GetChaincode(ccname string, ccversion string) (ccprovider.CCPackage, error)
}
PackageProvider gets chaincode packages from the filesystem.
type PendingQueryResult ¶
type PendingQueryResult struct {
// contains filtered or unexported fields
}
func (*PendingQueryResult) Add ¶
func (p *PendingQueryResult) Add(queryResult commonledger.QueryResult) error
func (*PendingQueryResult) Cut ¶
func (p *PendingQueryResult) Cut() []*pb.QueryResultBytes
func (*PendingQueryResult) Size ¶
func (p *PendingQueryResult) Size() int
type Processor ¶
type Processor interface {
Process(ctxt context.Context, vmtype string, req container.VMCReq) error
}
Processor processes vm and container requests.
type QueryResponseBuilder ¶
type QueryResponseBuilder interface {
BuildQueryResponse(txContext *TransactionContext, iter commonledger.ResultsIterator, iterID string) (*pb.QueryResponse, error)
}
QueryResponseBuilder is responsible for building QueryResponse messages for query transactions initiated by chaincode.
type QueryResponseGenerator ¶
type QueryResponseGenerator struct {
MaxResultLimit int
}
func (*QueryResponseGenerator) BuildQueryResponse ¶
func (q *QueryResponseGenerator) BuildQueryResponse(txContext *TransactionContext, iter commonledger.ResultsIterator, iterID string) (*pb.QueryResponse, error)
NewQueryResponse takes an iterator and fetch state to construct QueryResponse
type Registry ¶
type Registry interface { Register(*Handler) error Ready(cname string) Failed(cname string, err error) Deregister(cname string) error }
A Registry is responsible for tracking handlers.
type Runtime ¶
type Runtime interface { Start(ctxt context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error Stop(ctxt context.Context, cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error }
Runtime is used to manage chaincode runtime instances.
type RuntimeLauncher ¶
type RuntimeLauncher struct { Runtime Runtime Registry LaunchRegistry PackageProvider PackageProvider Lifecycle *Lifecycle StartupTimeout time.Duration }
RuntimeLauncher is responsible for launching chaincode runtimes.
func (*RuntimeLauncher) Launch ¶
func (r *RuntimeLauncher) Launch(ctx context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) error
Launch chaincode with the appropriate runtime.
type SystemCCProvider ¶
type SystemCCProvider interface { IsSysCC(name string) bool IsSysCCAndNotInvokableCC2CC(name string) bool }
SystemCCProvider provides system chaincode metadata.
type TransactionContext ¶
type TransactionContext struct { ChainID string SignedProp *pb.SignedProposal Proposal *pb.Proposal ResponseNotifier chan *pb.ChaincodeMessage TXSimulator ledger.TxSimulator HistoryQueryExecutor ledger.HistoryQueryExecutor // contains filtered or unexported fields }
func (*TransactionContext) CleanupQueryContext ¶
func (t *TransactionContext) CleanupQueryContext(queryID string)
func (*TransactionContext) CloseQueryIterators ¶
func (t *TransactionContext) CloseQueryIterators()
func (*TransactionContext) GetPendingQueryResult ¶
func (t *TransactionContext) GetPendingQueryResult(queryID string) *PendingQueryResult
func (*TransactionContext) GetQueryIterator ¶
func (t *TransactionContext) GetQueryIterator(queryID string) commonledger.ResultsIterator
func (*TransactionContext) InitializeQueryContext ¶
func (t *TransactionContext) InitializeQueryContext(queryID string, iter commonledger.ResultsIterator)
type TransactionContexts ¶
type TransactionContexts struct {
// contains filtered or unexported fields
}
TransactionContexts maintains active transaction contexts for a Handler.
func NewTransactionContexts ¶
func NewTransactionContexts() *TransactionContexts
NewTransactionContexts creates a registry for active transaction contexts.
func (*TransactionContexts) Close ¶
func (c *TransactionContexts) Close()
Close closes all query iterators assocated with the context.
func (*TransactionContexts) Create ¶
func (c *TransactionContexts) Create(ctx context.Context, chainID, txID string, signedProp *pb.SignedProposal, proposal *pb.Proposal) (*TransactionContext, error)
Create creates a new TransactionContext for the specified chain and transaction ID. An error is returned when a transaction context has already been created for the specified chain and transaction ID.
func (*TransactionContexts) Delete ¶
func (c *TransactionContexts) Delete(chainID, txID string)
Delete removes the transaction context associated with the specified chain and transaction ID.
func (*TransactionContexts) Get ¶
func (c *TransactionContexts) Get(chainID, txID string) *TransactionContext
Get retrieves the transaction context associated with the chain and transaction ID.
type TransactionRegistry ¶
type TransactionRegistry interface { Add(channelID, txID string) bool Remove(channelID, txID string) }
TransactionRegistry tracks active transactions for each channel.
type UUIDGenerator ¶
type UUIDGenerator interface {
New() string
}
UUIDGenerator is responsible for creating unique query identifiers.
type UUIDGeneratorFunc ¶
type UUIDGeneratorFunc func() string
func (UUIDGeneratorFunc) New ¶
func (u UUIDGeneratorFunc) New() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
lib
|
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
car
# Copyright State Street Corp.
|
# Copyright State Street Corp. |
ccmetadata
# Copyright State Street Corp.
|
# Copyright State Street Corp. |
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. |