options

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPeerFilter

func WithPeerFilter(value PeerFilter) copts.Opt

WithPeerFilter sets a peer filter which provides per-request filtering of peers

func WithPeerSorter

func WithPeerSorter(value PeerSorter) copts.Opt

WithPeerSorter sets a peer sorter function which provides per-request sorting of peers

func WithPrioritySelector

func WithPrioritySelector(value PrioritySelector) copts.Opt

WithPrioritySelector sets a priority selector function which provides per-request prioritization of peers

func WithRetryOpts

func WithRetryOpts(value retry.Opts) copts.Opt

WithRetryOpts sets the retry options

Types

type Params

type Params struct {
	PeerFilter PeerFilter
	PeerSorter PeerSorter
	RetryOpts  retry.Opts
}

Params defines the parameters of a selection service request

func NewParams

func NewParams(opts []copts.Opt) *Params

NewParams creates new parameters based on the provided options

func (*Params) SetPeerFilter

func (p *Params) SetPeerFilter(value PeerFilter)

SetPeerFilter sets the peer filter

func (*Params) SetPeerSorter

func (p *Params) SetPeerSorter(value PeerSorter)

SetPeerSorter sets the priority selector

func (*Params) SetRetryOpts

func (p *Params) SetRetryOpts(value retry.Opts)

SetRetryOpts sets the priority selector

type PeerFilter

type PeerFilter func(peer fab.Peer) bool

PeerFilter filters out unwanted peers

type PeerSorter

type PeerSorter func(peers []fab.Peer) []fab.Peer

PeerSorter sorts the peers

type PrioritySelector

type PrioritySelector func(peer1, peer2 fab.Peer) int

PrioritySelector determines how likely a peer is to be selected over another peer. A positive return value means peer1 is selected; negative return value means the peer2 is selected; zero return value means their priorities are the same

Jump to

Keyboard shortcuts

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