chclient

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCEvent

type CCEvent struct {
	TxID        string
	ChaincodeID string
	EventName   string
	Payload     []byte
}

CCEvent contains the data for a chaincocde event

type ChannelClient

type ChannelClient interface {

	// Query chaincode with request and optional options provided
	Query(request Request, opts ...Option) (Response, error)

	// Execute execute transaction with request and optional options provided
	Execute(request Request, opts ...Option) (Response, error)

	// InvokeHandler invokes the given handler with the given request and optional options provided
	InvokeHandler(handler Handler, request Request, options ...Option) (Response, error)

	// RegisterChaincodeEvent registers chain code event
	// @param {chan bool} channel which receives event details when the event is complete
	// @returns {object}  object handle that should be used to unregister
	RegisterChaincodeEvent(notify chan<- *CCEvent, chainCodeID string, eventID string) (Registration, error)

	// UnregisterChaincodeEvent unregisters chain code event
	UnregisterChaincodeEvent(registration Registration) error

	// Close releases channel client resources (disconnects event hub etc.)
	Close() error
}

ChannelClient ...

  • A channel client instance provides a handler to interact with peers on specified channel.
  • An application that requires interaction with multiple channels should create a separate
  • instance of the channel client for each channel. Channel client supports non-admin functions only. *
  • Each Client instance maintains {@link Channel} instance representing channel and the associated
  • private ledgers. *

type ClientContext

type ClientContext struct {
	CryptoSuite apicryptosuite.CryptoSuite
	Channel     apifabclient.Channel
	Discovery   apifabclient.DiscoveryService
	Selection   apifabclient.SelectionService
	EventHub    apifabclient.EventHub
}

ClientContext contains context parameters for handler execution

type Handler

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

Handler for chaining transaction executions

type Option

type Option func(opts *Opts) error

Option func for each Opts argument

func WithProposalProcessor

func WithProposalProcessor(proposalProcessors ...apifabclient.ProposalProcessor) Option

WithProposalProcessor encapsulates ProposalProcessors to Option

func WithRetry

func WithRetry(opt retry.Opts) Option

WithRetry option to configure retries

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout encapsulates time.Duration to Option

type Opts

type Opts struct {
	ProposalProcessors []apifabclient.ProposalProcessor // targets
	Timeout            time.Duration
	Retry              retry.Opts
}

Opts allows the user to specify more advanced options

type Registration

type Registration interface {
}

Registration is a handle that is returned from a successful Register Chaincode Event. This handle should be used in Unregister in order to unregister the event.

type Request

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

Request contains the parameters to execute transaction

type RequestContext

type RequestContext struct {
	Request      Request
	Opts         Opts
	Response     Response
	Error        error
	RetryHandler retry.Handler
}

RequestContext contains request, opts, response parameters for handler execution

type Response

type Response struct {
	Payload          []byte
	TransactionID    apifabclient.TransactionID
	TxValidationCode pb.TxValidationCode
	Responses        []*apifabclient.TransactionProposalResponse
}

Response contains response parameters for query and execute transaction

Jump to

Keyboard shortcuts

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