util

package
v0.3.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MemberForName

func MemberForName(members []*etcd.Member, name string) *etcd.Member

MemberForName returns the etcd member with the matching name.

Types

type UInt64Set

type UInt64Set map[uint64]empty

util.UInt64Set is a set of uint64s, implemented via map[uint64]struct{} for minimal memory consumption.

func MemberIDSet

func MemberIDSet(members []*etcd.Member) UInt64Set

MemberIDSet returns a set of member IDs.

func NewUInt64Set

func NewUInt64Set(items ...uint64) UInt64Set

NewUInt64Set creates a UInt64Set from a list of values.

func (UInt64Set) Delete

func (s UInt64Set) Delete(items ...uint64) UInt64Set

Delete removes all items from the set.

func (UInt64Set) Difference

func (s UInt64Set) Difference(s2 UInt64Set) UInt64Set

Difference returns a set of objects that are not in s2 For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.Difference(s2) = {a3} s2.Difference(s1) = {a4, a5}

func (UInt64Set) Equal

func (s UInt64Set) Equal(s2 UInt64Set) bool

Equal returns true if and only if s1 is equal (as a set) to s2. Two sets are equal if their membership is identical. (In practice, this means same elements, order doesn't matter)

func (UInt64Set) Has

func (s UInt64Set) Has(item uint64) bool

Has returns true if and only if item is contained in the set.

func (UInt64Set) HasAll

func (s UInt64Set) HasAll(items ...uint64) bool

HasAll returns true if and only if all items are contained in the set.

func (UInt64Set) HasAny

func (s UInt64Set) HasAny(items ...uint64) bool

HasAny returns true if any items are contained in the set.

func (UInt64Set) Insert

func (s UInt64Set) Insert(items ...uint64) UInt64Set

Insert adds items to the set.

func (UInt64Set) Intersection

func (s UInt64Set) Intersection(s2 UInt64Set) UInt64Set

Intersection returns a new set which includes the item in BOTH s1 and s2 For example: s1 = {a1, a2} s2 = {a2, a3} s1.Intersection(s2) = {a2}

func (UInt64Set) IsSuperset

func (s UInt64Set) IsSuperset(s2 UInt64Set) bool

IsSuperset returns true if and only if s1 is a superset of s2.

func (UInt64Set) Len

func (s UInt64Set) Len() int

Len returns the size of the set.

func (UInt64Set) List

func (s UInt64Set) List() []uint64

List returns the contents as a sorted uint64 slice.

func (UInt64Set) PopAny

func (s UInt64Set) PopAny() (uint64, bool)

Returns a single element from the set.

func (UInt64Set) Union

func (s UInt64Set) Union(s2 UInt64Set) UInt64Set

Union returns a new set which includes items in either s1 or s2. For example: s1 = {a1, a2} s2 = {a3, a4} s1.Union(s2) = {a1, a2, a3, a4} s2.Union(s1) = {a1, a2, a3, a4}

func (UInt64Set) UnsortedList

func (s UInt64Set) UnsortedList() []uint64

UnsortedList returns the slice with contents in random order.

Jump to

Keyboard shortcuts

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