invoke

package
v1.0.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package invoke provides the handlers for performing chaincode invocations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCFilter

type CCFilter func(ccID string) bool

CCFilter returns true if the given chaincode should be included in the invocation chain when computing endorsers.

func NewChainedCCFilter

func NewChainedCCFilter(filters ...CCFilter) CCFilter

NewChainedCCFilter returns a chaincode filter that chains multiple filters together. False is returned if at least one of the filters in the chain returns false.

type ClientContext

type ClientContext struct {
	CryptoSuite  core.CryptoSuite
	Discovery    fab.DiscoveryService
	Selection    fab.SelectionService
	Membership   fab.ChannelMembership
	Transactor   fab.Transactor
	EventService fab.EventService
}

ClientContext contains context parameters for handler execution

type CommitTxHandler

type CommitTxHandler struct {
	// contains filtered or unexported fields
}

CommitTxHandler for committing transactions

func NewCommitHandler

func NewCommitHandler(next ...Handler) *CommitTxHandler

NewCommitHandler returns a handler that commits transaction propsal responses

func (*CommitTxHandler) Handle

func (c *CommitTxHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle handles commit tx

type EndorsementHandler

type EndorsementHandler struct {
	// contains filtered or unexported fields
}

EndorsementHandler for handling endorse transactions

func NewEndorsementHandler

func NewEndorsementHandler(next ...Handler) *EndorsementHandler

NewEndorsementHandler returns a handler that endorses a transaction proposal

func NewEndorsementHandlerWithOpts

func NewEndorsementHandlerWithOpts(next Handler, provider TxnHeaderOptsProvider) *EndorsementHandler

NewEndorsementHandlerWithOpts returns a handler that endorses a transaction proposal

func (*EndorsementHandler) Handle

func (e *EndorsementHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle for endorsing transactions

type EndorsementValidationHandler

type EndorsementValidationHandler struct {
	// contains filtered or unexported fields
}

EndorsementValidationHandler for transaction proposal response filtering

func NewEndorsementValidationHandler

func NewEndorsementValidationHandler(next ...Handler) *EndorsementValidationHandler

NewEndorsementValidationHandler returns a handler that validates an endorsement

func (*EndorsementValidationHandler) Handle

func (f *EndorsementValidationHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle for Filtering proposal response

type Handler

type Handler interface {
	Handle(context *RequestContext, clientContext *ClientContext)
}

Handler for chaining transaction executions

func NewExecuteHandler

func NewExecuteHandler(next ...Handler) Handler

NewExecuteHandler returns execute handler with chain of SelectAndEndorseHandler, EndorsementValidationHandler, SignatureValidationHandler and CommitHandler

func NewQueryHandler

func NewQueryHandler(next ...Handler) Handler

NewQueryHandler returns query handler with chain of ProposalProcessorHandler, EndorsementHandler, EndorsementValidationHandler and SignatureValidationHandler

func NewSelectAndEndorseHandler

func NewSelectAndEndorseHandler(next ...Handler) Handler

NewSelectAndEndorseHandler returns a new SelectAndEndorseHandler

type Opts

type Opts struct {
	Targets       []fab.Peer // targets
	TargetFilter  fab.TargetFilter
	TargetSorter  fab.TargetSorter
	Retry         retry.Opts
	BeforeRetry   retry.BeforeRetryHandler
	Timeouts      map[fab.TimeoutType]time.Duration
	ParentContext reqContext.Context //parent grpc context
	CCFilter      CCFilter
}

Opts allows the user to specify more advanced options

type ProposalProcessorHandler

type ProposalProcessorHandler struct {
	// contains filtered or unexported fields
}

ProposalProcessorHandler for selecting proposal processors

func NewProposalProcessorHandler

func NewProposalProcessorHandler(next ...Handler) *ProposalProcessorHandler

NewProposalProcessorHandler returns a handler that selects proposal processors

func (*ProposalProcessorHandler) Handle

func (h *ProposalProcessorHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle selects proposal processors

type Request

type Request struct {
	ChaincodeID  string
	Fcn          string
	Args         [][]byte
	TransientMap map[string][]byte

	// InvocationChain contains meta-data that's used by some Selection Service implementations
	// to choose endorsers that satisfy the endorsement policies of all chaincodes involved
	// in an invocation chain (i.e. for CC-to-CC invocations).
	// Each chaincode may also be associated with a set of private data collection names
	// which are used by some Selection Services (e.g. Fabric Selection) to exclude endorsers
	// that do NOT have read access to the collections.
	// The invoked chaincode (specified by ChaincodeID) may optionally be added to the invocation
	// chain along with any collections, otherwise it may be omitted.
	InvocationChain []*fab.ChaincodeCall
}

Request contains the parameters to execute transaction

type RequestContext

type RequestContext struct {
	Request         Request
	Opts            Opts
	Response        Response
	Error           error
	RetryHandler    retry.Handler
	Ctx             reqContext.Context
	SelectionFilter selectopts.PeerFilter
	PeerSorter      selectopts.PeerSorter
}

RequestContext contains request, opts, response parameters for handler execution

type Response

type Response struct {
	Proposal         *fab.TransactionProposal
	Responses        []*fab.TransactionProposalResponse
	TransactionID    fab.TransactionID
	TxValidationCode pb.TxValidationCode
	ChaincodeStatus  int32
	Payload          []byte
}

Response contains response parameters for query and execute transaction

type SelectAndEndorseHandler

type SelectAndEndorseHandler struct {
	*EndorsementHandler
	// contains filtered or unexported fields
}

SelectAndEndorseHandler selects endorsers according to the policies of the chaincodes in the provided invocation chain and then sends the proposal to those endorsers. The read/write sets from the responses are then checked to see if additional chaincodes were invoked that were not in the original invocation chain. If so, a new endorser set is computed with the additional chaincodes and (if necessary) endorsements are requested from those additional endorsers.

func (*SelectAndEndorseHandler) Handle

func (e *SelectAndEndorseHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle selects endorsers and sends proposals to the endorsers

type SignatureValidationHandler

type SignatureValidationHandler struct {
	// contains filtered or unexported fields
}

SignatureValidationHandler for transaction proposal response filtering

func NewSignatureValidationHandler

func NewSignatureValidationHandler(next ...Handler) *SignatureValidationHandler

NewSignatureValidationHandler returns a handler that validates an endorsement

func (*SignatureValidationHandler) Handle

func (f *SignatureValidationHandler) Handle(requestContext *RequestContext, clientContext *ClientContext)

Handle for Filtering proposal response

type TxnHeaderOptsProvider

type TxnHeaderOptsProvider func() []fab.TxnHeaderOpt

TxnHeaderOptsProvider provides transaction header options which allow the provider to specify a custom creator and/or nonce.

Jump to

Keyboard shortcuts

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