kubernetes: k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations Index | Files

package nestedpendingoperations

import "k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations"

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

Package Files

nestedpendingoperations.go

Constants

const (
    // EmptyUniquePodName is a UniquePodName for empty string.
    EmptyUniquePodName types.UniquePodName = types.UniquePodName("")

    // EmptyUniqueVolumeName is a UniqueVolumeName for empty string
    EmptyUniqueVolumeName v1.UniqueVolumeName = v1.UniqueVolumeName("")
)

func IsAlreadyExists Uses

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 Uses

func NewAlreadyExistsError(operationKey string) error

NewAlreadyExistsError returns a new instance of AlreadyExists error.

type NestedPendingOperations Uses

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, same or empty podName
    // and same operationName exits, an AlreadyExists or ExponentialBackoff
    // error is returned. If an operation with same volumeName and podName
    // has ExponentialBackoff error but operationName is different, exponential
    // backoff is reset and operation is allowed to proceed.
    // 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 v1.UniqueVolumeName, podName types.UniquePodName, generatedOperations types.GeneratedOperations) 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()

    // IsOperationPending returns true if an operation for the given volumeName and podName is pending,
    // otherwise it returns false
    IsOperationPending(volumeName v1.UniqueVolumeName, podName types.UniquePodName) bool
}

NestedPendingOperations defines the supported set of operations.

func NewNestedPendingOperations Uses

func NewNestedPendingOperations(exponentialBackOffOnError bool) NestedPendingOperations

NewNestedPendingOperations returns a new instance of NestedPendingOperations.

Package nestedpendingoperations imports 7 packages (graph) and is imported by 75 packages. Updated 2019-05-21. Refresh now. Tools for package owners.