types

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package for declaring types that will be used by various other packages. This is useful for preventing import cycles. For example, pkg/pods depends on pkg/auth. If both wish to use pods.ID, an import cycle is created.

Index

Constants

View Source
const (
	AvailabilityZoneLabel = "availability_zone"
	ClusterNameLabel      = "cluster_name"
	PodIDLabel            = "pod_id"
)
View Source
const (
	PodUUIDLength int = 36
)

Variables

View Source
var InvalidUUID = errors.New("does not parse as a uuid")

Functions

func HomeToPodUUID

func HomeToPodUUID(home string) *uuid.UUID

Types

type NodeName

type NodeName string

func (NodeName) String

func (n NodeName) String() string

type NodeSet

type NodeSet struct {
	sets.String
}

Wraps sets.String to provide the functionality of a set when dealing with the NodeName type (which is a string)

func NewNodeSet

func NewNodeSet(nodes ...NodeName) NodeSet

func (NodeSet) DeleteNode

func (n NodeSet) DeleteNode(node NodeName)

func (NodeSet) Difference

func (n NodeSet) Difference(other NodeSet) NodeSet

func (NodeSet) Equal

func (n NodeSet) Equal(other NodeSet) bool

func (NodeSet) InsertNode

func (n NodeSet) InsertNode(node NodeName)

func (NodeSet) Intersection

func (n NodeSet) Intersection(other NodeSet) NodeSet

func (NodeSet) ListNodes

func (n NodeSet) ListNodes() []NodeName

func (NodeSet) PopAny

func (n NodeSet) PopAny() (NodeName, bool)

type PodID

type PodID string

Refers to the id: key in a pod manifest, i.e. the name of the application running in the pod. There may be multiple copies (pods) of a given pod id running at a given time

func (PodID) String

func (p PodID) String() string

type PodLocation

type PodLocation struct {
	Node  NodeName `json:"node"`
	PodID PodID    `json:"pod_id"`
}

type PodLocations

type PodLocations []PodLocation

func (PodLocations) Nodes

func (l PodLocations) Nodes() []NodeName

Nodes returns a list of just the locations' nodes.

type PodUniqueKey

type PodUniqueKey string // empty for legacy pods, uuid otherwise

A unique identifier for each pod (instance) expressed as a UUID. Supporting UUIDs is a new feature, so typically it will be empty. An empty PodUniqueKey signifies a legacy pod for which there is no uuid.

P2 will begin using uuids instead of the previous format to better support running multiple pods with the same pod id on the same node. Certain new functionality will only be supported for pods with UUID unique keys, hence the need for checking for non-nil values.

func NewPodUUID

func NewPodUUID() PodUniqueKey

func ToPodUniqueKey

func ToPodUniqueKey(podUniqueKeyStr string) (PodUniqueKey, error)

Turns a string into a PodUniqueKey iff the string properly parses as a UUID

func (PodUniqueKey) String

func (p PodUniqueKey) String() string

Jump to

Keyboard shortcuts

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