FileSpaceStrategies class
Strategies for selecting a filesystem from a set of candidates.
All strategies filter out filesystems that are unavailable or exceed candidateFileSystemMaxUsedPercent (default 99%). When no candidate survives filtering, strategies fall back to leastUsed().
Public static functions
-
static auto selectFileSystem(const std::
vector<PathName>& fileSystems, const std:: string& strategy) -> const PathName& - Dispatch to the named strategy.
-
static auto leastUsed(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick the filesystem with the most absolute free space.
-
static auto leastUsedPercent(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick the filesystem with the highest percentage of free space.
-
static auto roundRobin(const std::
vector<PathName>& fileSystems) -> const PathName& - Cycle through candidates in order, seeded by PID.
-
static auto pureRandom(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick uniformly at random among candidates.
-
static auto weightedRandom(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick randomly, weighted by absolute available space.
-
static auto weightedRandomPercent(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick randomly, weighted by percentage of available space.
-
static auto binnedLeastUsed(const std::
vector<PathName>& fileSystems) -> const PathName& - Pick randomly among candidates in the top availability bin.
Constructors, destructors, conversion operators
- FileSpaceStrategies() deleted
Function documentation
static const PathName& eckit:: FileSpaceStrategies:: selectFileSystem(const std:: vector<PathName>& fileSystems,
const std:: string& strategy)
Dispatch to the named strategy.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| strategy | strategy name — one of "roundRobin", "weightedRandom", "pureRandom", "weightedRandomPercent", "leastUsedPercent", "binnedLeastUsed"; any other value selects "leastUsed" |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: leastUsed(const std:: vector<PathName>& fileSystems)
Pick the filesystem with the most absolute free space.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: leastUsedPercent(const std:: vector<PathName>& fileSystems)
Pick the filesystem with the highest percentage of free space.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: roundRobin(const std:: vector<PathName>& fileSystems)
Cycle through candidates in order, seeded by PID.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: pureRandom(const std:: vector<PathName>& fileSystems)
Pick uniformly at random among candidates.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: weightedRandom(const std:: vector<PathName>& fileSystems)
Pick randomly, weighted by absolute available space.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: weightedRandomPercent(const std:: vector<PathName>& fileSystems)
Pick randomly, weighted by percentage of available space.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
static const PathName& eckit:: FileSpaceStrategies:: binnedLeastUsed(const std:: vector<PathName>& fileSystems)
Pick randomly among candidates in the top availability bin.
| Parameters | |
|---|---|
| fileSystems | candidate filesystem paths |
| Returns | selected path |
Divides the available-space range into eckit config value binnedLeastUsedNumBins bins (default 20). Only candidates in the topmost bin are eligible; one is chosen uniformly at random.