A class that implements a weak file system abstraction.
More...
#include <LogicalFileSystem.h>
A class that implements a weak file system abstraction.
◆ LogicalFileSystem()
wrench::LogicalFileSystem::LogicalFileSystem |
( |
std::string |
hostname, |
|
|
StorageService * |
storage_service, |
|
|
std::string |
mount_point |
|
) |
| |
|
explicit |
Constructor.
- Parameters
-
hostname | the host on which the file system is located |
storage_service | the storage service this file system is for |
mount_point | the mount point |
◆ createDirectory()
void wrench::LogicalFileSystem::createDirectory |
( |
std::string |
absolute_path | ) |
|
Create a new directory.
- Parameters
-
absolute_path | the directory's absolute path |
- Exceptions
-
◆ 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
-
- 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
-
◆ isFileInDirectory()
bool wrench::LogicalFileSystem::isFileInDirectory |
( |
std::shared_ptr< DataFile > |
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
-
◆ listFilesInDirectory()
std::set< std::shared_ptr< DataFile > > 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
-
◆ removeAllFilesInDirectory()
void wrench::LogicalFileSystem::removeAllFilesInDirectory |
( |
std::string |
absolute_path | ) |
|
Remove all files in a directory.
- Parameters
-
absolute_path | the directory's absolute path |
- Exceptions
-
◆ removeEmptyDirectory()
void wrench::LogicalFileSystem::removeEmptyDirectory |
( |
std::string |
absolute_path | ) |
|
Remove an empty directory.
- Parameters
-
absolute_path | the directory's absolute path |
- Exceptions
-
◆ removeFileFromDirectory()
void wrench::LogicalFileSystem::removeFileFromDirectory |
( |
std::shared_ptr< DataFile > |
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
-
◆ reserveSpace()
void wrench::LogicalFileSystem::reserveSpace |
( |
std::shared_ptr< DataFile > |
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
-
◆ storeFileInDirectory()
void wrench::LogicalFileSystem::storeFileInDirectory |
( |
std::shared_ptr< DataFile > |
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
-
◆ unreserveSpace()
void wrench::LogicalFileSystem::unreserveSpace |
( |
std::shared_ptr< DataFile > |
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
-
The documentation for this class was generated from the following files: