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(n int32, signedBy ...*common.SignaturePolicy) *common.SignaturePolicy
NewNOutOfPolicy creates an NOutOf signature policy
func NewPrincipal(name string, classification mb.MSPPrincipal_Classification) (*mb.MSPPrincipal, error)
NewPrincipal creates a new MSPPrincipal
func NewSignedByPolicy(index int32) *common.SignaturePolicy
NewSignedByPolicy creates a SignaturePolicy at the given index
Collapsable is implemented by any group that can collapse into a simple (non-hierarchical) Group
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
}
Group contains a group of Items
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
}
func NewGroup(items []Item) Group
NewGroup creates a new Group
GroupOfGroups contains a set of groups.
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)
}
func NewGroupOfGroups(groups []Group) GroupOfGroups
NewGroupOfGroups returns a new group of groups
GroupRetriever is a function that returns groups of peers
type GroupRetriever func(peerRetriever MSPPeerRetriever) (GroupOfGroups, error)
func CompileSignaturePolicy(sigPolicyEnv *common.SignaturePolicyEnvelope) (GroupRetriever, error)
CompileSignaturePolicy compiles the given signature policy and returns a GroupRetriever
Item represents any item
type Item interface {
}
LoadBalancePolicy is used to pick a peer group from a given set of peer groups
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
}
func NewRandomLBP() LoadBalancePolicy
NewRandomLBP returns a random load-balance policy
func NewRoundRobinLBP() LoadBalancePolicy
NewRoundRobinLBP returns a round-robin load-balance policy
MSPPeerRetriever is a function that retrieves peers by MSPID
type MSPPeerRetriever func(mspID string) []fab.Peer
PeerGroup contains a group of Peers
type PeerGroup interface {
Group
Peers() []fab.Peer
}
func NewMSPPeerGroup(mspID string, peerRetriever MSPPeerRetriever) PeerGroup
NewMSPPeerGroup returns a new MSP PeerGroup
func NewPeerGroup(peers ...fab.Peer) PeerGroup
NewPeerGroup returns a new PeerGroup
PeerGroupResolver resolves a group of peers that would (exactly) satisfy a chaincode's endorsement policy.
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)
}
func NewPeerGroupResolver(groupRetriever GroupRetriever, lbp LoadBalancePolicy) (PeerGroupResolver, error)
NewPeerGroupResolver returns a new PeerGroupResolver
func NewRandomPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope) (PeerGroupResolver, error)
NewRandomPeerGroupResolver returns a PeerGroupResolver that chooses peers in a round-robin fashion
func NewRoundRobinPeerGroupResolver(sigPolicyEnv *common.SignaturePolicyEnvelope) (PeerGroupResolver, error)
NewRoundRobinPeerGroupResolver returns a PeerGroupResolver that chooses peers in a round-robin fashion