Documentation ¶
Index ¶
Constants ¶
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 (*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 ¶
type ClientRPC interface { ControllerDetachVolume(args *cstructs.ClientCSIControllerDetachVolumeRequest, reply *cstructs.ClientCSIControllerDetachVolumeResponse) error NodeDetachVolume(args *cstructs.ClientCSINodeDetachVolumeRequest, reply *cstructs.ClientCSINodeDetachVolumeResponse) error }
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(batchDuration time.Duration, raft VolumeRaftEndpoints, ctx context.Context) *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.