A class that implements a weak file system abstraction. More...
#include <LogicalFileSystem.h>
Public Member Functions | |
LogicalFileSystem (std::string hostname, std::string ss_name, std::string mount_point) | |
Constructor. More... | |
void | createDirectory (std::string absolute_path) |
Create a new directory. More... | |
bool | doesDirectoryExist (std::string absolute_path) |
Checks whether a directory exists. More... | |
double | getFreeSpace () |
Get the file system's free space. More... | |
double | getTotalCapacity () |
Get the total capacity. More... | |
bool | hasEnoughFreeSpace (double bytes) |
Checks whether there is enough space to store some number of bytes. More... | |
void | init () |
Initializes the Logical File System (must be called before any other operation on this file system) | |
bool | isDirectoryEmpty (std::string absolute_path) |
Checks whether a directory is empty. More... | |
bool | isFileInDirectory (WorkflowFile *file, std::string absolute_path) |
Checks whether a file is in a directory. More... | |
std::set< WorkflowFile * > | listFilesInDirectory (std::string absolute_path) |
Get the files in a directory as a set. More... | |
void | removeAllFilesInDirectory (std::string absolute_path) |
Remove all files in a directory. More... | |
void | removeEmptyDirectory (std::string absolute_path) |
Remove an empty directory. More... | |
void | removeFileFromDirectory (WorkflowFile *file, std::string absolute_path) |
Remove a file in a directory. More... | |
void | reserveSpace (WorkflowFile *file, std::string absolute_path) |
Reserve space for a file that will be stored. More... | |
void | storeFileInDirectory (WorkflowFile *file, std::string absolute_path) |
Store file in directory. More... | |
void | unreserveSpace (WorkflowFile *file, std::string absolute_path) |
Unreserve space that was saved for a file (likely a failed transfer) More... | |
Detailed Description
A class that implements a weak file system abstraction.
Constructor & Destructor Documentation
◆ LogicalFileSystem()
|
explicit |
Constructor.
- Parameters
-
hostname the host on which the file system is located ss_name the storage service this file system is for mount_point the mount point
Member Function Documentation
◆ createDirectory()
void wrench::LogicalFileSystem::createDirectory | ( | std::string | absolute_path | ) |
Create a new directory.
- Parameters
-
absolute_path the directory's absolute path
- Exceptions
-
std::invalid_argument
◆ doesDirectoryExist()
bool wrench::LogicalFileSystem::doesDirectoryExist | ( | std::string | absolute_path | ) |
Checks whether a directory exists.
- Parameters
-
absolute_path the directory's absolute path
- Returns
- true if the directory exists
◆ getFreeSpace()
double wrench::LogicalFileSystem::getFreeSpace | ( | ) |
Get the file system's free space.
- Returns
- the free space in bytes
◆ getTotalCapacity()
double wrench::LogicalFileSystem::getTotalCapacity | ( | ) |
Get the total capacity.
- Returns
- the total capacity
◆ hasEnoughFreeSpace()
bool wrench::LogicalFileSystem::hasEnoughFreeSpace | ( | double | bytes | ) |
Checks whether there is enough space to store some number of bytes.
- Parameters
-
bytes a number of bytes
- Returns
- true if the number of bytes can fit
◆ isDirectoryEmpty()
bool wrench::LogicalFileSystem::isDirectoryEmpty | ( | std::string | absolute_path | ) |
Checks whether a directory is empty.
- Parameters
-
absolute_path the directory's absolute path
- Returns
- true if the directory is empty
- Exceptions
-
std::invalid_argument
◆ isFileInDirectory()
bool wrench::LogicalFileSystem::isFileInDirectory | ( | WorkflowFile * | file, |
std::string | absolute_path | ||
) |
Checks whether a file is in a directory.
- Parameters
-
file the file absolute_path the directory's absolute path
- Returns
- true if the file is present
- Exceptions
-
std::invalid_argument
◆ listFilesInDirectory()
std::set< WorkflowFile * > wrench::LogicalFileSystem::listFilesInDirectory | ( | std::string | absolute_path | ) |
Get the files in a directory as a set.
- Parameters
-
absolute_path the directory's absolute path
- Returns
- a set of files
- Exceptions
-
std::invalid_argument
◆ removeAllFilesInDirectory()
void wrench::LogicalFileSystem::removeAllFilesInDirectory | ( | std::string | absolute_path | ) |
Remove all files in a directory.
- Parameters
-
absolute_path the directory's absolute path
- Exceptions
-
std::invalid_argument
◆ removeEmptyDirectory()
void wrench::LogicalFileSystem::removeEmptyDirectory | ( | std::string | absolute_path | ) |
Remove an empty directory.
- Parameters
-
absolute_path the directory's absolute path
- Exceptions
-
std::invalid_argument
◆ removeFileFromDirectory()
void wrench::LogicalFileSystem::removeFileFromDirectory | ( | WorkflowFile * | file, |
std::string | absolute_path | ||
) |
Remove a file in a directory.
- Parameters
-
file the file to remove absolute_path the directory's absolute path
- Exceptions
-
std::invalid_argument
◆ reserveSpace()
void wrench::LogicalFileSystem::reserveSpace | ( | WorkflowFile * | file, |
std::string | absolute_path | ||
) |
Reserve space for a file that will be stored.
- Parameters
-
file the file absolute_path the path where it will be written
- Exceptions
-
std::invalid_argument
◆ storeFileInDirectory()
void wrench::LogicalFileSystem::storeFileInDirectory | ( | WorkflowFile * | file, |
std::string | absolute_path | ||
) |
Store file in directory.
- Parameters
-
file the file to store absolute_path the directory's absolute path (at the mount point)
- Exceptions
-
std::invalid_argument
◆ unreserveSpace()
void wrench::LogicalFileSystem::unreserveSpace | ( | WorkflowFile * | file, |
std::string | absolute_path | ||
) |
Unreserve space that was saved for a file (likely a failed transfer)
- Parameters
-
file the file absolute_path the path where it would have been written
- Exceptions
-
std::invalid_argument
The documentation for this class was generated from the following files:
- LogicalFileSystem.h
- LogicalFileSystem.cpp