Documentation ¶
Overview ¶
Package diskcheck provides a communication channel for checking the disk health.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
Checker represents the downloader disk health component. The disk checker job is to notify its caller when the disk health state changes.
The interface describes two main concepts:
Run: The component's main loop which loops between the health state functions. The running function implicates the current disk health.
C: The health state communication channel used by the processor.
Useful implementation details:
waitForHealthy, waitForSick: health state monitoring functions that report back to the channel when the state changes. They can be canceled with ctx.
diskUsage: the disk usage percentage.
Healthy/Sick: the disk health state.
We need to stall the worker pools when the hd capacity drops below a threshold and restart them when we have again enough hd capacity. To achieve that, the processor reads from the communication channel the health state. Our approach implicitly considers that the disk checker will only write to the channel when there is a health state change.
The health checking functions execution order determines the current health state, which enables us to keep the implementation free from saving states.