7 return message.c_str();
27 minFreeThreshold(minFreeThreshold_) {
31 storageLocations.emplace_back(path);
32 if (storageLocations.size() == 1) {
33 currentLocation = storageLocations.begin();
38 if (storageLocations.empty()) {
42 if (currentFree >= minFreeThreshold) {
43 return *currentLocation;
45 for(
auto it = storageLocations.begin(); it != storageLocations.end(); ++it) {
47 if (thisFree > currentFree) {
48 currentFree = thisFree;
52 if (currentFree >= minFreeThreshold) {
53 return *currentLocation;
std::string getPreferredStorageLocation()
Ask for a good location to store data.
~NoStorageLocationGiven()
Base class for all StorageManager exceptions.
All defined storage locations have insufficient free space.
~StorageManagerException()
void addStorageLocation(const std::string &path)
Add a new storage location.
StorageManagerException(const std::string &_message)
Storage location was requested but none have been defined.
StorageManager(double minFreeThreshold_=.05)
Construct a StorageManager.
virtual const char * what() const
double getDiskFreePercent(const std::string &path) const
Get free fraction of the disk behind the given path.