package setmatrix

import "github.com/dotcloud/docker/libnetwork/internal/setmatrix"

Index

Types

type SetMatrix

type SetMatrix[K, V comparable] struct {
	// contains filtered or unexported fields
}

SetMatrix is a map of Sets. The zero value is an empty set matrix ready to use.

SetMatrix values are safe for concurrent use.

func (*SetMatrix[K, V]) Cardinality

func (s *SetMatrix[K, V]) Cardinality(key K) (cardinality int, ok bool)

Cardinality returns the number of elements in the set for a key.

func (*SetMatrix[K, V]) Contains

func (s *SetMatrix[K, V]) Contains(key K, value V) (containsElement, setExists bool)

Contains is used to verify if an element is in a set for a specific key.

func (*SetMatrix[K, V]) Get

func (s *SetMatrix[K, V]) Get(key K) ([]V, bool)

Get returns the members of the set for a specific key as a slice.

func (*SetMatrix[K, V]) Insert

func (s *SetMatrix[K, V]) Insert(key K, value V) (inserted bool, cardinality int)

Insert inserts the value in the set of a key and returns whether the value is inserted (was not already in the set) and the number of elements in the set.

func (*SetMatrix[K, V]) Keys

func (s *SetMatrix[K, V]) Keys() []K

Keys returns all the keys in the map.

func (*SetMatrix[K, V]) Remove

func (s *SetMatrix[K, V]) Remove(key K, value V) (removed bool, cardinality int)

Remove removes the value in the set for a specific key.

func (*SetMatrix[K, V]) String

func (s *SetMatrix[K, V]) String(key K) (v string, ok bool)

String returns the string version of the set. The empty string is returned if there is no set for key.

Source Files

setmatrix.go

Version
v28.2.2+incompatible (latest)
Published
May 30, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
14 seconds ago

Tools for package owners.