discovery

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CcCalls

func CcCalls(ccNames ...string) []*peer.ChaincodeCall

CcCalls creates an array of ChaincodeCalls based of cc names, can be used in AddPeersQuery(CcCalls(...))

func CcInterests

func CcInterests(invocationsChains ...[]*peer.ChaincodeCall) []*peer.ChaincodeInterest

CcInterests creates an array of ChaincodeInterests based of ChaincodeCalls, can be used in AddEndorsersQuery(CcInterests(CcCalls(...)))

func GetProperties

func GetProperties(endpoint *discclient.Peer) fab.Properties

GetProperties extracts the properties from the discovered peer.

Types

type Client

type Client interface {
	Send(ctx context.Context, req *Request, targets ...fab.PeerConfig) (<-chan Response, error)
}

Client gives ability to send discovery request to multiple targets. There are cases when multiple targets requested and some of them are hanging, recommended to cancel ctx after first successful response. Note: "access denied" is a success response, so check for it after response evaluation.

func New

func New(ctx fabcontext.Client) (Client, error)

New returns a new Discover client

type Request

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

Request aggregates several queries inside it

func NewRequest

func NewRequest() *Request

NewRequest creates a new request

func (*Request) AddConfigQuery

func (req *Request) AddConfigQuery() *Request

AddConfigQuery adds to the request a config query

func (*Request) AddEndorsersQuery

func (req *Request) AddEndorsersQuery(interests ...*peer.ChaincodeInterest) (*Request, error)

AddEndorsersQuery adds to the request a query for given chaincodes interests are the chaincode interests that the client wants to query for. All interests for a given channel should be supplied in an aggregated slice

func (*Request) AddLocalPeersQuery

func (req *Request) AddLocalPeersQuery() *Request

AddLocalPeersQuery adds to the request a local peer query

func (*Request) AddPeersQuery

func (req *Request) AddPeersQuery(invocationChain ...*peer.ChaincodeCall) *Request

AddPeersQuery adds to the request a peer query

func (*Request) OfChannel

func (req *Request) OfChannel(ch string) *Request

OfChannel sets the next queries added to be in the given channel's context

type Response

type Response interface {
	discclient.Response
	Target() string
	Error() error
}

Response extends the response from the Discovery invocation on the peer by adding the endpoint URL of the peer that was invoked.

Jump to

Keyboard shortcuts

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