sortedset

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

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 NewCluster added in v0.2.0

func NewCluster() Cluster

NewCluster returns a new empty Cluster

func (Cluster) Equal added in v0.2.0

func (c Cluster) Equal(other Cluster) bool

Equal tests for equality with another Cluster

func (*Cluster) Insert added in v0.2.0

func (c *Cluster) Insert(b []byte) bool

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

func (c *Cluster) IntersectCluster(committeeSet uint64) Cluster

IntersectCluster performs an intersect operation with a Cluster represented through a uint64 bitmap

func (Cluster) OccurrencesOf added in v0.2.0

func (c Cluster) OccurrencesOf(b []byte) int

OccurrencesOf return the occurrence a []byte has been inserted in the cluster

func (*Cluster) Remove added in v0.2.0

func (c *Cluster) Remove(b []byte) bool

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

func (c *Cluster) RemoveAll(b []byte) int

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

func (c Cluster) TotalOccurrences() int

TotalOccurrences returns the amount of elements in the cluster

func (Cluster) Unravel added in v0.2.0

func (c Cluster) Unravel() [][]byte

Unravel creates a sorted array of []byte adding as many duplicates as the occurrence of the various elements in ascending order

type Set

type Set []*big.Int

Set is an ordered set of big.Int

func New

func New() Set

New creates a new instance of a sorted set

func (*Set) Bits

func (v *Set) Bits(subset Set) uint64

Bits creates a bit representation of the subset of a Set. The subset is passed by value

func (Set) Equal

func (v Set) Equal(other Set) bool

Equal tests a set for equality

func (Set) IndexOf

func (v Set) IndexOf(b []byte) (int, bool)

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

func (v *Set) Insert(b []byte) bool

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

func (v Set) Intersect(committeeSet uint64) Set

Intersect the bit representation of a VotingCommittee subset with the whole VotingCommittee set

func (Set) Len

func (v Set) Len() int

Len complies with the Sort interface

func (Set) Less

func (v Set) Less(i, j int) bool

Less complies with the Sort interface

func (*Set) Remove

func (v *Set) Remove(pubKeyBLS []byte) bool

Remove an entry from the set. Return false if the entry can't be found

func (Set) String

func (v Set) String() string

func (Set) Swap

func (v Set) Swap(i, j int)

Swap complies with the Sort interface

func (Set) Whole

func (v Set) Whole() uint64

Whole returns the bitmap of all the elements within the set

Jump to

Keyboard shortcuts

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