wrench::StorageService
-
class StorageService : public wrench::Service
The storage service base class.
Subclassed by wrench::SimpleStorageService, wrench::XRootD::Node
Public Functions
Store a file at a particular mount point ex-nihilo. Doesn’t notify a file registry service and will do nothing (and won’t complain) if the file already exists at that location.
- Parameters
file – a file
Store a file at a particular mount point ex-nihilo. Doesn’t notify a file registry service and will do nothing (and won’t complain) if the file already exists at that location.
- Parameters
file – a file
location – a file location, must be the same object as the function is envoked on
- Throws
std::invalid_argument –
Store a file at a particular mount point ex-nihilo. Doesn’t notify a file registry service and will do nothing (and won’t complain) if the file already exists at that location.
- Parameters
file – a file
path – path to file
Synchronously delete a file at a location.
- Parameters
file – the file
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 –
-
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
-
virtual double getLoad() = 0
Get the theoretical load of a service.
- Returns
the load on the service
-
virtual std::string getMountPoint()
Get the mount point (will throw is more than one)
- Returns
the (sole) mount point of the service
-
virtual 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
-
virtual 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
-
virtual bool hasMultipleMountPoints()
Checked whether the storage service has multiple mount points.
- Returns
true whether the service has multiple mount points
Synchronously asks the storage service whether it holds a file.
- Parameters
file – the file
- Throws
std::invalid_arguments –
- Returns
true or false
Synchronously read a file from the storage service.
- Parameters
file – the file
- Throws
std::invalid_arguments –
Synchronously read a file from the storage service.
- Parameters
file – the file
path – the absolute file path
- Throws
std::invalid_arguments –
Synchronously read a file from the storage service.
- Parameters
file – the file
path – the absolute file path
num_bytes – the number of bytes to read
- Throws
std::invalid_arguments –
Synchronously read a file from the storage service.
- Parameters
file – the file
num_bytes – the number of bytes to read
- Throws
std::invalid_arguments –
-
virtual void stop() override
Stop the service.
Synchronously write a file to the storage service.
- Parameters
file – the file
- Throws
Synchronously write a file to the storage service.
- Parameters
file – the file
path – path to file
- Throws
Public Static Functions
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 –
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 write a file to the storage service.
- Parameters
file – the file
location – the location to write it to
- Throws