pgresolver

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 9 Imported by: 23 modules, 22 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPolicies

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

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

NewNOutOfPolicy creates an NOutOf signature policy

func NewPrincipal

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

NewPrincipal creates a new MSPPrincipal

func NewSignedByPolicy

func NewSignedByPolicy(index int32) *common.SignaturePolicy

NewSignedByPolicy creates a SignaturePolicy at the given index

Types

type Collapsable

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

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

func NewGroup(items []Item) Group

NewGroup creates a new Group

type GroupOfGroups

type GroupOfGroups interface {
	// GroupOfGroups is also a Group
	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

func NewGroupOfGroups(groups []Group) GroupOfGroups

NewGroupOfGroups returns a new group of groups

type GroupRetriever

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

GroupRetriever is a function that returns groups of peers

func CompileSignaturePolicy

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

CompileSignaturePolicy compiles the given signature policy and returns a GroupRetriever

type Item

type Item interface {
}

Item represents any item

type LoadBalancePolicy

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

func NewRandomLBP() LoadBalancePolicy

NewRandomLBP returns a random load-balance policy

func NewRoundRobinLBP

func NewRoundRobinLBP() LoadBalancePolicy

NewRoundRobinLBP returns a round-robin load-balance policy

type MSPPeerRetriever

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

MSPPeerRetriever is a function that retrieves peers by MSPID

type PeerGroup

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

PeerGroup contains a group of Peers

func NewMSPPeerGroup

func NewMSPPeerGroup(mspID string, peerRetriever MSPPeerRetriever) PeerGroup

NewMSPPeerGroup returns a new MSP PeerGroup

func NewPeerGroup

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

NewPeerGroup returns a new PeerGroup

type PeerGroupResolver

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

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

NewPeerGroupResolver returns a new PeerGroupResolver

func NewRandomPeerGroupResolver

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

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

func NewRoundRobinPeerGroupResolver

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

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

Jump to

Keyboard shortcuts

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