fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/client/common/selection/sorter/blockheightsorter Index | Files

package blockheightsorter

import "github.com/hyperledger/fabric-sdk-go/pkg/client/common/selection/sorter/blockheightsorter"

Index

Package Files

blockheightsorter.go opts.go

Constants

const (

    // Disable disables choosing by block height threshold meaning that any peer has a likelihood of being chosen
    Disable = -1
)

func New Uses

func New(opts ...coptions.Opt) options.PeerSorter

New returns a peer sorter that uses block height and the provided balancer to sort the peers. This sorter uses a block-height-lag-threshold property which is the number of blocks from the highest block of a group of peers that a peer can lag behind and still be considered to be up-to-date. These peers are sorted using the given Balancer. If a peer's block height falls behind this "lag" threshold then it will be demoted to a lower priority list of peers which will be sorted according to block height.

func WithBalancer Uses

func WithBalancer(value balancer.Balancer) options.Opt

WithBalancer sets the balancing strategy to load balance (sort) the peers.

func WithBlockHeightLagThreshold Uses

func WithBlockHeightLagThreshold(value int) options.Opt

WithBlockHeightLagThreshold is the number of blocks from the highest block of a group of peers that a peer can lag behind and still be considered to be up-to-date. These peers are sorted using the given Balancer. If a peer's block height falls behind this "lag" threshold then it will be demoted to a lower priority list of peers which is sorted according to block height.

If set to 0 then only the most up-to-date peers are considered. If set to -1 then all peers (regardless of block height) will be load-balanced using the provided balancer.

Package blockheightsorter imports 6 packages (graph) and is imported by 1 packages. Updated 2018-09-19. Refresh now. Tools for package owners.