sets

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

README

This package contains hand-coded set implementations that should be similar to the autogenerated ones in pkg/util/sets.

We can't simply use net.IPNet as a map-key in Go (because it contains a []byte).

We could use the same workaround we use here (a string representation as the key) to autogenerate sets. If we do that, or decide on an alternate approach, we should replace the implementations in this package with the autogenerated versions.

It is expected that callers will alias this import as netsets i.e. import netsets "k8s.io/kubernetes/pkg/util/net/sets"

Analytics

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPNet

type IPNet map[string]*net.IPNet

func ParseIPNets

func ParseIPNets(specs ...string) (IPNet, error)

func (IPNet) Delete

func (s IPNet) Delete(items ...*net.IPNet)

Delete removes all items from the set.

func (IPNet) Difference

func (s IPNet) Difference(s2 IPNet) IPNet

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 (IPNet) Equal

func (s1 IPNet) Equal(s2 IPNet) 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 (IPNet) Has

func (s IPNet) Has(item *net.IPNet) bool

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

func (IPNet) HasAll

func (s IPNet) HasAll(items ...*net.IPNet) bool

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

func (IPNet) Insert

func (s IPNet) Insert(items ...*net.IPNet)

Insert adds items to the set.

func (IPNet) IsSuperset

func (s1 IPNet) IsSuperset(s2 IPNet) bool

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

func (IPNet) Len

func (s IPNet) Len() int

Len returns the size of the set.

func (IPNet) StringSlice

func (s IPNet) StringSlice() []string

StringSlice returns a []string with the String representation of each element in the set. Order is undefined.

Jump to

Keyboard shortcuts

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