nestedpendingoperations

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package nestedpendingoperations is a modified implementation of pkg/util/goroutinemap. It implements a data structure for managing go routines by volume/pod name. It prevents the creation of new go routines if an existing go routine for the volume already exists. It also allows multiple operations to execute in parallel for the same volume as long as they are operating on different pods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if an error returned from NestedPendingOperations indicates a new operation can not be started because an operation with the same operation name is already executing.

func NewAlreadyExistsError

func NewAlreadyExistsError(operationName string) error

NewAlreadyExistsError returns a new instance of AlreadyExists error.

Types

type NestedPendingOperations

type NestedPendingOperations interface {
	// Run adds the concatenation of volumeName and podName to the list of
	// running operations and spawns a new go routine to execute operationFunc.
	// If an operation with the same volumeName and same or empty podName
	// exists, an AlreadyExists or ExponentialBackoff error is returned.
	// This enables multiple operations to execute in parallel for the same
	// volumeName as long as they have different podName.
	// Once the operation is complete, the go routine is terminated and the
	// concatenation of volumeName and podName is removed from the list of
	// executing operations allowing a new operation to be started with the
	// volumeName without error.
	Run(volumeName api.UniqueVolumeName, podName types.UniquePodName, operationFunc func() error) error

	// Wait blocks until all operations are completed. This is typically
	// necessary during tests - the test should wait until all operations finish
	// and evaluate results after that.
	Wait()
}

NestedPendingOperations defines the supported set of operations.

func NewNestedPendingOperations

func NewNestedPendingOperations(exponentialBackOffOnError bool) NestedPendingOperations

NewNestedPendingOperations returns a new instance of NestedPendingOperations.

Jump to

Keyboard shortcuts

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