fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/events/client/peerresolver/preferpeer Index | Files

package preferpeer

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/events/client/peerresolver/preferpeer"

Index

Package Files

opts.go preferpeer.go

func NewResolver Uses

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

NewResolver returns a new "prefer peer" resolver provider.

type PeerResolver Uses

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 Uses

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 Uses

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 Uses

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

func (*PeerResolver) ShouldDisconnect Uses

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.

Package preferpeer imports 10 packages (graph). Updated 2018-11-02. Refresh now. Tools for package owners.