Documentation ¶
Index ¶
- Variables
- type ChannelResponse
- type Client
- type Dialer
- type Endorsers
- type ExclusionFilter
- type Filter
- type InvocationChain
- type LocalResponse
- type MemoizeSigner
- type Peer
- type Priority
- type PrioritySelector
- type Request
- func (req *Request) AddConfigQuery() *Request
- func (req *Request) AddEndorsersQuery(interests ...*discovery.ChaincodeInterest) (*Request, error)
- func (req *Request) AddLocalPeersQuery() *Request
- func (req *Request) AddPeersQuery(invocationChain ...*discovery.ChaincodeCall) *Request
- func (req *Request) OfChannel(ch string) *Request
- type Response
- type Signer
Constants ¶
This section is empty.
Variables ¶
var ( // PrioritiesByHeight selects peers by descending height PrioritiesByHeight = &byHeight{} // NoExclusion accepts all peers and rejects no peers NoExclusion = selectionFunc(noExclusion) // NoPriorities is indifferent to how it selects peers NoPriorities = &noPriorities{} )
var ( // ErrNotFound defines an error that means that an element wasn't found ErrNotFound = errors.New("not found") )
var NoFilter = NewFilter(NoPriorities, NoExclusion)
NoFilter returns a noop Filter
Functions ¶
This section is empty.
Types ¶
type ChannelResponse ¶
type ChannelResponse interface { // Config returns a response for a config query, or error if something went wrong Config() (*discovery.ConfigResult, error) // Peers returns a response for a peer membership query, or error if something went wrong Peers(invocationChain ...*discovery.ChaincodeCall) ([]*Peer, error) // Endorsers returns the response for an endorser query for a given // chaincode in a given channel context, or error if something went wrong. // The method returns a random set of endorsers, such that signatures from all of them // combined, satisfy the endorsement policy. // The selection is based on the given selection hints: // Filter: Filters and sorts the endorsers // The given InvocationChain specifies the chaincode calls (along with collections) // that the client passed during the construction of the request Endorsers(invocationChain InvocationChain, f Filter) (Endorsers, error) }
ChannelResponse aggregates responses for a given channel
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client interacts with the discovery server
type Endorsers ¶
type Endorsers []*Peer
Endorsers defines a set of peers that are sufficient for satisfying some chaincode's endorsement policy
func (Endorsers) Filter ¶
func (endorsers Endorsers) Filter(f ExclusionFilter) Endorsers
Filter filters the endorsers according to the given ExclusionFilter
func (Endorsers) Sort ¶
func (endorsers Endorsers) Sort(ps PrioritySelector) Endorsers
Sort sorts the endorsers according to the given PrioritySelector
type ExclusionFilter ¶
type ExclusionFilter interface { // Exclude returns whether the given Peer is to be excluded or not Exclude(Peer) bool }
ExclusionFilter returns true if the given Peer is not to be considered when selecting peers
func ExcludeByHost ¶
func ExcludeByHost(reject func(host string) bool) ExclusionFilter
ExcludeByHost creates a ExclusionFilter out of the given exclusion predicate
func ExcludeHosts ¶
func ExcludeHosts(endpoints ...string) ExclusionFilter
ExcludeHosts returns a ExclusionFilter that excludes the given endpoints
type Filter ¶ added in v1.3.0
Filter filters and sorts the given endorsers
func NewFilter ¶ added in v1.3.0
func NewFilter(ps PrioritySelector, ef ExclusionFilter) Filter
NewFilter returns an endorser filter that uses the given exclusion filter and priority selector to filter and sort the endorsers
type InvocationChain ¶
type InvocationChain []*discovery.ChaincodeCall
InvocationChain aggregates ChaincodeCalls
func (InvocationChain) String ¶
func (ic InvocationChain) String() string
String returns a string representation of this invocation chain
func (InvocationChain) ValidateInvocationChain ¶
func (ic InvocationChain) ValidateInvocationChain() error
ValidateInvocationChain validates the InvocationChain's structure
type LocalResponse ¶
type LocalResponse interface { // Peers returns a response for a local peer membership query, or error if something went wrong Peers() ([]*Peer, error) }
LocalResponse aggregates responses for a channel-less scope
type MemoizeSigner ¶ added in v1.3.0
MemoizeSigner signs messages with the same signature if the message was signed recently
func NewMemoizeSigner ¶ added in v1.3.0
func NewMemoizeSigner(signFunc Signer, maxEntries uint) *MemoizeSigner
NewMemoizeSigner creates a new MemoizeSigner that signs message with the given sign function
type Peer ¶
type Peer struct { MSPID string AliveMessage *gossip.SignedGossipMessage StateInfoMessage *gossip.SignedGossipMessage Identity []byte }
Peer aggregates identity, membership and channel-scoped information of a certain peer.
type Priority ¶
type Priority int
Priority 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
type PrioritySelector ¶
type PrioritySelector interface { // Compare compares between 2 peers and returns // their relative scores Compare(Peer, Peer) Priority }
PrioritySelector guides the selection of peers via giving peers a relative priority to their selection
type Request ¶
Request aggregates several queries inside it
func (*Request) AddConfigQuery ¶
AddConfigQuery adds to the request a config query
func (*Request) AddEndorsersQuery ¶
func (req *Request) AddEndorsersQuery(interests ...*discovery.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 ¶
AddLocalPeersQuery adds to the request a local peer query
func (*Request) AddPeersQuery ¶
func (req *Request) AddPeersQuery(invocationChain ...*discovery.ChaincodeCall) *Request
AddPeersQuery adds to the request a peer query
type Response ¶
type Response interface { // ForChannel returns a ChannelResponse in the context of a given channel ForChannel(string) ChannelResponse // ForLocal returns a LocalResponse in the context of no channel ForLocal() LocalResponse }
Response aggregates several responses from the discovery service