wrench::StorageService
-
class wrench::StorageService : public wrench::Service
The storage service base class.
Subclassed by wrench::SimpleStorageService
Public Functions
-
StorageService(const std::string &hostname, const std::set<std::string> &mount_points, const std::string &service_name)
Constructor.
- Parameters
hostname – the name of the host on which the service should run
mount_points – the mount points of each disk usable by the service
service_name – the name of the storage service
- Throws
std::invalid_argument –
-
std::map<std::string, double> getFreeSpace()
Synchronously asks the storage service for its capacity at all its mount points.
- Throws
std::runtime_error –
- Returns
The free space in bytes of each mount point, as a map
-
std::string getMountPoint()
Get the mount point (will throw is more than one)
- Returns
the (sole) mount point of the service
-
std::set<std::string> getMountPoints()
Get the set of mount points.
- Returns
the set of mount points
-
std::map<std::string, double> getTotalSpace()
Get the total static capacity of the storage service (in zero simulation time)
- Returns
capacity of the storage service (double) for each mount point, in a map
-
bool hasMountPoint(const std::string &mp)
Checked whether the storage service has a particular mount point.
- Parameters
mp – a mount point
- Returns
true whether the service has that mount point
-
bool hasMultipleMountPoints()
Checked whether the storage service has multiple mount points.
- Returns
true whether the service has multiple mount points
-
bool isScratch() const
Determines whether the storage service is a scratch service of a ComputeService.
- Returns
true if it is, false otherwise
-
void setScratch()
Indicate that this storace service is a scratch service of a ComputeService.
-
virtual void stop() override
Stop the service.
Public Static Functions
Synchronously ask the storage service to read a file from another storage service.
- Parameters
file – the file to copy
src_location – the location where to read the file
dst_location – the location where to write the file
- Throws
std::invalid_argument –
Synchronously delete a file at a location.
- Parameters
file – the file
location – the file’s location
file_registry_service – a file registry service that should be updated once the file deletion has (successfully) completed (none if nullptr)
- Throws
std::runtime_error –
std::invalid_argument –
Asynchronously ask for a file copy between two storage services.
- Parameters
answer_mailbox – the mailbox to which a notification message will be sent
file – the file
src_location – the source location
dst_location – the destination location
- Throws
std::invalid_argument –
Synchronously asks the storage service whether it holds a file.
- Parameters
file – the file
location – the file location
- Throws
std::invalid_arguments –
- Returns
true or false
Synchronously read a file from the storage service.
- Parameters
file – the file
location – the location to read the file from
- Throws
std::invalid_arguments –
Synchronously read a file from the storage service.
- Parameters
file – the file
location – the location to read the file from
num_bytes_to_read – number of bytes to read from the file
- Throws
std::invalid_arguments –
Synchronously and sequentially read a set of files from storage services.
- Parameters
locations – a map of files to locations
- Throws
std::runtime_error –
Synchronously write a file to the storage service.
- Parameters
file – the file
location – the location to write it to
- Throws
Synchronously and sequentially upload a set of files from storage services.
- Parameters
locations – a map of files to locations
- Throws
std::runtime_error –
-
StorageService(const std::string &hostname, const std::set<std::string> &mount_points, const std::string &service_name)