Documentation ¶
Index ¶
- Constants
- type Cluster
- func (c Cluster) Equal(other Cluster) bool
- func (c *Cluster) Insert(b []byte) bool
- func (c *Cluster) IntersectCluster(committeeSet uint64) Cluster
- func (c Cluster) OccurrencesOf(b []byte) int
- func (c *Cluster) Remove(b []byte) bool
- func (c *Cluster) RemoveAll(b []byte) int
- func (c Cluster) TotalOccurrences() int
- func (c Cluster) Unravel() [][]byte
- type Set
- func (v *Set) Bits(subset Set) uint64
- func (v Set) Copy() Set
- func (v Set) Equal(other Set) bool
- func (v Set) IndexOf(b []byte) (int, bool)
- func (v *Set) Insert(b []byte) bool
- func (v Set) Intersect(committeeSet uint64) Set
- func (v Set) Len() int
- func (v Set) Less(i, j int) bool
- func (v *Set) Remove(pubKeyBLS []byte) bool
- func (v Set) String() string
- func (v Set) Swap(i, j int)
- func (v Set) Whole() uint64
Constants ¶
const All uint64 = math.MaxUint64
All represents the bitmap of the whole set.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶ added in v0.2.0
type Cluster struct { Set // contains filtered or unexported fields }
Cluster is a sortedset that keeps track of duplicates.
func (*Cluster) Insert ¶ added in v0.2.0
Insert a []byte into the cluster and updates the element counts. Returns true if the element is new, false otherwise.
func (*Cluster) IntersectCluster ¶ added in v0.2.0
IntersectCluster performs an intersect operation with a Cluster represented through a uint64 bitmap.
func (Cluster) OccurrencesOf ¶ added in v0.2.0
OccurrencesOf return the occurrence a []byte has been inserted in the cluster.
func (*Cluster) Remove ¶ added in v0.2.0
Remove a []byte from the cluster and updates the element counts. Returns false if the element cannot be found.
func (*Cluster) RemoveAll ¶ added in v0.2.0
RemoveAll occurrences of a []byte from the cluster and updates the element counts. Returns the amount of occurrences that have been removed.
func (Cluster) TotalOccurrences ¶ added in v0.2.0
TotalOccurrences returns the amount of elements in the cluster.
type Set ¶
Set is an ordered set of big.Int.
func (*Set) Bits ¶
Bits creates a bit representation of the subset of a Set. The subset is passed by value.
func (Set) IndexOf ¶
IndexOf returns the index at which a byte slice should be inserted and whether the element is actually found or otherwise. Internally uses big.Int representation.
func (*Set) Insert ¶
Insert a big.Int representation of a BLS key at a proper index (respectful of the VotingCommittee order). If the element is already in the VotingCommittee does nothing and returns false.
func (Set) Intersect ¶
Intersect the bit representation of a VotingCommittee subset with the whole VotingCommittee set.