{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package discovery\n\n## Variables\n\n```go\nvar (\n\t// PrioritiesByHeight selects peers by descending height\n\tPrioritiesByHeight = \u0026byHeight{}\n\t// NoExclusion accepts all peers and rejects no peers\n\tNoExclusion = selectionFunc(noExclusion)\n\t// NoPriorities is indifferent to how it selects peers\n\tNoPriorities = \u0026noPriorities{}\n)\n```\n\n```go\nvar (\n\t// ErrNotFound defines an error that means that an element wasn't found\n\tErrNotFound = errors.New(\"not found\")\n)\n```\n\n```go\nvar NoFilter = NewFilter(NoPriorities, NoExclusion)\n```\nNoFilter returns a noop Filter\n\n## Types\n\n```go\ntype ChannelResponse interface {\n\t// Config returns a response for a config query, or error if something went wrong\n\tConfig() (*discovery.ConfigResult, error)\n\n\t// Peers returns a response for a peer membership query, or error if something went wrong\n\tPeers(invocationChain ...*discovery.ChaincodeCall) ([]*Peer, error)\n\n\t// Endorsers returns the response for an endorser query for a given\n\t// chaincode in a given channel context, or error if something went wrong.\n\t// The method returns a random set of endorsers, such that signatures from all of them\n\t// combined, satisfy the endorsement policy.\n\t// The selection is based on the given selection hints:\n\t// Filter: Filters and sorts the endorsers\n\t// The given InvocationChain specifies the chaincode calls (along with collections)\n\t// that the client passed during the construction of the request\n\tEndorsers(invocationChain InvocationChain, f Filter) (Endorsers, error)\n}\n```\nChannelResponse aggregates responses for a given channel\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient interacts with the discovery server\n\n```go\nfunc NewClient(createConnection Dialer, s Signer, signerCacheSize uint) *Client\n```\nNewClient creates a new Client instance\n\n```go\nfunc (c *Client) Send(ctx context.Context, req *Request, auth *discovery.AuthInfo) (Response, error)\n```\nSend sends the request and returns the response, or error on failure\n\n```go\ntype Dialer func() (*grpc.ClientConn, error)\n```\nDialer connects to the server\n\n```go\ntype Endorsers []*Peer\n```\nEndorsers defines a set of peers that are sufficient for satisfying some chaincode's endorsement policy\n\n```go\nfunc (endorsers Endorsers) Filter(f ExclusionFilter) Endorsers\n```\nFilter filters the endorsers according to the given ExclusionFilter\n\n```go\nfunc (endorsers Endorsers) Shuffle() Endorsers\n```\nShuffle sorts the endorsers in random order\n\n```go\nfunc (endorsers Endorsers) Sort(ps PrioritySelector) Endorsers\n```\nSort sorts the endorsers according to the given PrioritySelector\n\n```go\ntype ExclusionFilter interface {\n\t// Exclude returns whether the given Peer is to be excluded or not\n\tExclude(Peer) bool\n}\n```\nExclusionFilter returns true if the given Peer is not to be considered when selecting peers\n\n```go\nfunc ExcludeByHost(reject func(host string) bool) ExclusionFilter\n```\nExcludeByHost creates a ExclusionFilter out of the given exclusion predicate\n\n```go\nfunc ExcludeHosts(endpoints ...string) ExclusionFilter\n```\nExcludeHosts returns a ExclusionFilter that excludes the given endpoints\n\n```go\ntype Filter interface {\n\tFilter(endorsers Endorsers) Endorsers\n}\n```\nFilter filters and sorts the given endorsers\n\n```go\nfunc NewFilter(ps PrioritySelector, ef ExclusionFilter) Filter\n```\nNewFilter returns an endorser filter that uses the given exclusion filter and priority selector to filter and sort the endorsers\n\n```go\ntype InvocationChain []*discovery.ChaincodeCall\n```\nInvocationChain aggregates ChaincodeCalls\n\n```go\nfunc (ic InvocationChain) String() string\n```\nString returns a string representation of this invocation chain\n\n```go\nfunc (ic InvocationChain) ValidateInvocationChain() error\n```\nValidateInvocationChain validates the InvocationChain's structure\n\n```go\ntype LocalResponse interface {\n\t// Peers returns a response for a local peer membership query, or error if something went wrong\n\tPeers() ([]*Peer, error)\n}\n```\nLocalResponse aggregates responses for a channel-less scope\n\n```go\ntype MemoizeSigner struct {\n\tsync.RWMutex\n\t// contains filtered or unexported fields\n}\n```\nMemoizeSigner signs messages with the same signature if the message was signed recently\n\n```go\nfunc NewMemoizeSigner(signFunc Signer, maxEntries uint) *MemoizeSigner\n```\nNewMemoizeSigner creates a new MemoizeSigner that signs message with the given sign function\n\n```go\nfunc (ms *MemoizeSigner) Sign(msg []byte) ([]byte, error)\n```\nSigner signs a message and returns the signature and nil, or nil and error on failure\n\n```go\ntype Peer struct {\n\tMSPID            string\n\tAliveMessage     *gossip.SignedGossipMessage\n\tStateInfoMessage *gossip.SignedGossipMessage\n\tIdentity         []byte\n}\n```\nPeer aggregates identity, membership and channel-scoped information of a certain peer.\n\n```go\ntype Priority int\n```\nPriority defines how likely a peer is to be selected over another peer. Positive priority means the left peer is selected Negative priority means the right peer is selected Zero priority means their priorities are the same\n\n```go\ntype PrioritySelector interface {\n\t// Compare compares between 2 peers and returns\n\t// their relative scores\n\tCompare(Peer, Peer) Priority\n}\n```\nPrioritySelector guides the selection of peers via giving peers a relative priority to their selection\n\n```go\ntype Request struct {\n\t*discovery.Request\n\t// contains filtered or unexported fields\n}\n```\nRequest aggregates several queries inside it\n\n```go\nfunc NewRequest() *Request\n```\nNewRequest creates a new request\n\n```go\nfunc (req *Request) AddConfigQuery() *Request\n```\nAddConfigQuery adds to the request a config query\n\n```go\nfunc (req *Request) AddEndorsersQuery(interests ...*discovery.ChaincodeInterest) (*Request, error)\n```\nAddEndorsersQuery 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\n\n```go\nfunc (req *Request) AddLocalPeersQuery() *Request\n```\nAddLocalPeersQuery adds to the request a local peer query\n\n```go\nfunc (req *Request) AddPeersQuery(invocationChain ...*discovery.ChaincodeCall) *Request\n```\nAddPeersQuery adds to the request a peer query\n\n```go\nfunc (req *Request) OfChannel(ch string) *Request\n```\nOfChannel sets the next queries added to be in the given channel's context\n\n```go\ntype Response interface {\n\t// ForChannel returns a ChannelResponse in the context of a given channel\n\tForChannel(string) ChannelResponse\n\n\t// ForLocal returns a LocalResponse in the context of no channel\n\tForLocal() LocalResponse\n}\n```\nResponse aggregates several responses from the discovery service\n\n```go\ntype Signer func(msg []byte) ([]byte, error)\n```\nSigner signs a message and returns the signature and nil, or nil and error on failure\n\n","path":"github.com/eric-erki/https-hyperledger.org/discovery/client","name":"discovery","synopsis":"","isRedistributable":true}
