Documentation ¶
Index ¶
- func Serialize(elems []uint16) string
- type Grouping
- type Groupings
- func (gr *Groupings) AddTo(g *Grouping, group uint16) error
- func (gr *Groupings) Contains(g *Grouping, group uint16) bool
- func (gr *Groupings) Deserialize(label string) (*Grouping, error)
- func (gr *Groupings) Iter(g *Grouping, f func(group uint16) error) error
- func (gr *Groupings) N() int
- func (gr *Groupings) Serialize(g *Grouping) string
- func (gr *Groupings) WithinRange(group uint16) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Groupings ¶
type Groupings struct {
// contains filtered or unexported fields
}
Groupings maintain labels to identify membership to one or more groups. Labels are implemented as subsets of integers from 0 up to an excluded maximum, where the integers represent the groups. Assumptions:
- most labels are for one group or very few
- a few labels are sparse with more groups in them
- very few comprise the universe of all groups
func NewGroupings ¶
NewGroupings creates a new Groupings supporting labels for membership to up n groups. n must be a positive multiple of 16 and <=65536.
func (*Groupings) Deserialize ¶
Deserialize reconstructs a grouping out of the serialized label.
func (*Groupings) Iter ¶
Iter iterates over the groups in the grouping and calls f with each of them. If f returns an error Iter immediately returns with it.
func (*Groupings) N ¶
N returns up to how many groups are supported. That is the value that was passed to NewGroupings.
func (*Groupings) WithinRange ¶
WithinRange checks whether group is within the admissible range for labeling otherwise it returns an error.