volumewatcher

package
v0.12.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: MPL-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// LimitStateQueriesPerSecond is the number of state queries allowed per
	// second
	LimitStateQueriesPerSecond = 100.0

	// CrossVolumeUpdateBatchDuration is the duration in which volume
	// claim updates are batched across all volume watchers before
	// being committed to Raft.
	CrossVolumeUpdateBatchDuration = 250 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchFuture

type BatchFuture struct {
	// contains filtered or unexported fields
}

BatchFuture is a future that can be used to retrieve the index for the update or any error in the update process

func NewBatchFuture

func NewBatchFuture() *BatchFuture

NewBatchFuture returns a new BatchFuture

func (*BatchFuture) Results

func (f *BatchFuture) Results() (uint64, error)

Results returns the creation index and any error.

func (*BatchFuture) Set

func (f *BatchFuture) Set(index uint64, err error)

Set sets the results of the future, unblocking any client.

type ClientRPC

ClientRPC is a minimal interface of the Server, intended as an aid for testing logic surrounding server-to-server or server-to-client RPC calls and to avoid circular references between the nomad package and the volumewatcher

type VolumeRaftEndpoints

type VolumeRaftEndpoints interface {

	// UpsertVolumeClaims applys a batch of claims to raft
	UpsertVolumeClaims(*structs.CSIVolumeClaimBatchRequest) (uint64, error)
}

VolumeRaftEndpoints exposes the volume watcher to a set of functions to apply data transforms via Raft.

type VolumeUpdateBatcher

type VolumeUpdateBatcher struct {
	// contains filtered or unexported fields
}

VolumeUpdateBatcher is used to batch the updates for volume claims

func NewVolumeUpdateBatcher

func NewVolumeUpdateBatcher(ctx context.Context, batchDuration time.Duration, raft VolumeRaftEndpoints) *VolumeUpdateBatcher

NewVolumeUpdateBatcher returns an VolumeUpdateBatcher that uses the passed raft endpoints to create the updates to volume claims, and exits the batcher when the passed exit channel is closed.

func (*VolumeUpdateBatcher) CreateUpdate

func (b *VolumeUpdateBatcher) CreateUpdate(claims []structs.CSIVolumeClaimRequest) *BatchFuture

CreateUpdate batches the volume claim update and returns a future that can be used to track the completion of the batch. Note we only return the *last* future if the claims gets broken up across multiple batches because only the last one has useful information for the caller.

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher is used to watch volumes and their allocations created by the scheduler and trigger the scheduler when allocation health transitions.

func NewVolumesWatcher

func NewVolumesWatcher(logger log.Logger,
	raft VolumeRaftEndpoints, rpc ClientRPC, stateQueriesPerSecond float64,
	updateBatchDuration time.Duration) *Watcher

NewVolumesWatcher returns a volumes watcher that is used to watch volumes and trigger the scheduler as needed.

func (*Watcher) SetEnabled

func (w *Watcher) SetEnabled(enabled bool, state *state.StateStore)

SetEnabled is used to control if the watcher is enabled. The watcher should only be enabled on the active leader. When being enabled the state is passed in as it is no longer valid once a leader election has taken place.

Jump to

Keyboard shortcuts

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