preferpeer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(preferredPeers ...string) peerresolver.Provider

NewResolver returns a new "prefer peer" resolver provider.

Types

type PeerResolver

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

PeerResolver is a peer resolver that determines which peers are suitable based on block height, although will prefer the peers in the provided list (as long as their block height is above a configured threshold). If none of the peers in the provided list are suitable then an attempt is made to select a peer from the current org will be selected. If none of the peers from the current org are suitable then a peer from another org is chosen.

func New

func New(dispatcher service.Dispatcher, context context.Client, channelID string, preferredPeers []string, opts ...options.Opt) *PeerResolver

New returns a new "prefer peer" resolver.

func (*PeerResolver) Resolve

func (r *PeerResolver) Resolve(peers []fab.Peer) (fab.Peer, error)

Resolve uses the MinBlockHeight resolver to choose peers but will prefer the ones in the list of preferred peers.

func (PeerResolver) SetLoadBalancePolicy

func (p PeerResolver) SetLoadBalancePolicy(value lbp.LoadBalancePolicy)

func (*PeerResolver) ShouldDisconnect

func (r *PeerResolver) ShouldDisconnect(peers []fab.Peer, connectedPeer fab.Peer) bool

ShouldDisconnect determines whether the connected peer should be disconnected and reconnected to the preferred peer.

Jump to

Keyboard shortcuts

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