cache

package
v1.3.0-alpha.4 Latest Latest
Warning

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

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

Documentation

Overview

Package cache implements a data structure used by the attach/detach controller to keep track of volumes, the nodes they are attached to, and the pods that reference them. It is thread-safe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachDetachVolumeCache

type AttachDetachVolumeCache interface {
	// AddVolume adds the given volume to the list of volumes managed by the
	// attach detach controller.
	// If the volume already exists, this is a no-op.
	AddVolume(volumeName string)

	// AddNode adds the given node to the list of nodes the specified volume is
	// attached to.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	// If the node already exists for the specified volume, this is a no-op.
	AddNode(nodeName, volumeName string) error

	// AddPod adds the given pod to the list of pods that are scheduled to
	// the specified node and referencing the specified volume.
	// If no node with the name nodeName exists in the list of attached nodes,
	// an error is returned.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	// If the pod already exists for the specified volume, this is a no-op.
	AddPod(podName, nodeName, volumeName string) error

	// DeleteVolume removes the given volume from the list of volumes managed
	// by the attach detach controller.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	// All attachedNodes must be deleted from the volume before it is deleted.
	// If the specified volume contains 1 or more attachedNodes, an error is
	// returned.
	DeleteVolume(volumeName string) error

	// DeleteNode removes the given node from the list of nodes the specified
	// volume is attached to.
	// If no node with the name nodeName exists in the list of attached nodes,
	// an error is returned.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	// All scheduledPods must be deleted from the node before it is deleted.
	// If the specified node contains 1 or more scheduledPods, an error is
	// returned.
	DeleteNode(nodeName, volumeName string) error

	// DeletePod removes the given pod from the list of pods that are scheduled
	// to the specified node and referencing the specified volume.
	// If no pod with the name podName exists for the specified volume/node, an
	// error is returned.
	// If no node with the name nodeName exists in the list of attached nodes,
	// an error is returned.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	DeletePod(podName, nodeName, volumeName string) error

	// VolumeExists returns true if the volume with the specified name exists
	// in the list of volumes managed by the attach detach controller.
	VolumeExists(volumeName string) bool

	// NodeExists returns true if the node with the specified name exists in
	// the list of nodes the specified volume is attached to.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	NodeExists(nodeName, volumeName string) (bool, error)

	// PodExists returns true if the pod with the specified name exists in the
	// list of pods that are scheduled to the specified node and referencing
	// the specified volume.
	// If no node with the name nodeName exists in the list of attached nodes,
	// an error is returned.
	// If no volume with the name volumeName exists in the list of managed
	// volumes, an error is returned.
	PodExists(podName, nodeName, volumeName string) (bool, error)
}

AttachDetachVolumeCache defines the set of operations the volume cache supports.

func NewAttachDetachVolumeCache

func NewAttachDetachVolumeCache() AttachDetachVolumeCache

NewAttachDetachVolumeCache returns a new instance of the AttachDetachVolumeCache.

Jump to

Keyboard shortcuts

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