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

package pgresolver

import "github.com/hyperledger/fabric-sdk-go/pkg/client/common/selection/dynamicselection/pgresolver"


Package Files

groups.go groupsimpl.go lbpolicyimpl.go mocks.go pgresolver.go pgresolverimpl.go

func GetPolicies Uses

func GetPolicies(mspIDs ...string) (signedBy []*common.SignaturePolicy, identities []*mb.MSPPrincipal, err error)

GetPolicies creates a set of 'signed by' signature policies and corresponding identities for the given set of MSP IDs

func NewNOutOfPolicy Uses

func NewNOutOfPolicy(n int32, signedBy ...*common.SignaturePolicy) *common.SignaturePolicy

NewNOutOfPolicy creates an NOutOf signature policy

func NewPrincipal Uses

func NewPrincipal(name string, classification mb.MSPPrincipal_Classification) (*mb.MSPPrincipal, error)

NewPrincipal creates a new MSPPrincipal

func NewSignedByPolicy Uses

func NewSignedByPolicy(index int32) *common.SignaturePolicy

NewSignedByPolicy creates a SignaturePolicy at the given index

type Collapsable Uses

type Collapsable interface {
    // Collapse converts a hierarchical group into a single-level group (if possible).
    // For example, say G = (A and (B and C) and (D and E) and (F or G))
    // then G.Collapse() = (A and B and C and D and E and (F or G))
    Collapse() Group

Collapsable is implemented by any group that can collapse into a simple (non-hierarchical) Group

type Group Uses

type Group interface {
    // Items returns all of the items
    Items() []Item

    // Equals returns true if this Group contains the same items as the given Group
    Equals(other Group) bool

    // Reduce reduces the group (which may be a hierarchy of groups) into a simple, non-hierarchical set of groups.
    // For example, given the group, G=(A and (B or C or D))
    // then G.Reduce() = [(A and B) or (A and C) or (A and D)]
    Reduce() []Group

Group contains a group of Items

func NewGroup Uses

func NewGroup(items []Item) Group

NewGroup creates a new Group

type GroupOfGroups Uses

type GroupOfGroups interface {
    // GroupOfGroups is also a Group

    // Groups returns all of the groups in this container
    Groups() []Group

    // Nof returns a set of groups that includes all possible combinations for the given threshold.
    // For example, given the group-of-groups, G=(G1, G2, G3), where G1=(A or B), G2=(C or D), G3=(E or F),
    // then:
    // - G.Nof(1) = (G1 or G2 or G3)
    // - G.Nof(2) = ((G1 and G2) or (G1 and G3) or (G2 and G3)
    // - G.Nof(3) = (G1 and G2 and G3)
    Nof(threshold int32) (GroupOfGroups, error)

GroupOfGroups contains a set of groups.

func NewGroupOfGroups Uses

func NewGroupOfGroups(groups []Group) GroupOfGroups

NewGroupOfGroups returns a new group of groups

type GroupRetriever Uses

type GroupRetriever func(peerRetriever MSPPeerRetriever) (GroupOfGroups, error)

GroupRetriever is a function that returns groups of peers

func CompileSignaturePolicy Uses

func CompileSignaturePolicy(sigPolicyEnv *common.SignaturePolicyEnvelope) (GroupRetriever, error)

CompileSignaturePolicy compiles the given signature policy and returns a GroupRetriever

type Item Uses

type Item interface {

Item represents any item

type LoadBalancePolicy Uses

type LoadBalancePolicy interface {
    // Choose returns one of the peer groups from the given set of peer groups.
    // This method should never return nil but may return a PeerGroup that contains no peers.
    Choose(peerGroups []PeerGroup) PeerGroup

LoadBalancePolicy is used to pick a peer group from a given set of peer groups

func NewRandomLBP Uses

func NewRandomLBP() LoadBalancePolicy

NewRandomLBP returns a random load-balance policy

func NewRoundRobinLBP Uses

func NewRoundRobinLBP() LoadBalancePolicy

NewRoundRobinLBP returns a round-robin load-balance policy

type MSPPeerRetriever Uses

type MSPPeerRetriever func(mspID string) []fab.Peer

MSPPeerRetriever is a function that retrieves peers by MSPID

type PeerGroup Uses

type PeerGroup interface {
    Peers() []fab.Peer

PeerGroup contains a group of Peers

func NewMSPPeerGroup Uses

func NewMSPPeerGroup(mspID string, peerRetriever MSPPeerRetriever) PeerGroup

NewMSPPeerGroup returns a new MSP PeerGroup

func NewPeerGroup Uses

func NewPeerGroup(peers ...fab.Peer) PeerGroup

NewPeerGroup returns a new PeerGroup

type PeerGroupResolver Uses

type PeerGroupResolver interface {
    // Resolve returns a PeerGroup ensuring that all of the peers in the group are
    // in the given set of available peers.
    Resolve(peers []fab.Peer) (PeerGroup, error)

PeerGroupResolver resolves a group of peers that would (exactly) satisfy a chaincode's endorsement policy.

func NewPeerGroupResolver Uses

func NewPeerGroupResolver(groupRetriever GroupRetriever, lbp LoadBalancePolicy) (PeerGroupResolver, error)

NewPeerGroupResolver returns a new PeerGroupResolver

func NewRandomPeerGroupResolver Uses

func NewRandomPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope) (PeerGroupResolver, error)

NewRandomPeerGroupResolver returns a PeerGroupResolver that chooses peers in a round-robin fashion

func NewRoundRobinPeerGroupResolver Uses

func NewRoundRobinPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope) (PeerGroupResolver, error)

NewRoundRobinPeerGroupResolver returns a PeerGroupResolver that chooses peers in a round-robin fashion

Package pgresolver imports 9 packages (graph) and is imported by 1 packages. Updated 2020-08-09. Refresh now. Tools for package owners.