wrench::CompoundStorageService
-
class CompoundStorageService : public wrench::StorageService
An abstract storage service which holds a collection of concrete storage services (eg. SimpleStorageServices). It does not provide direct access to any storage resource. It is meant to be used as a way to postpone the selection of a storage service for a file action (read, write, copy, etc) until a later time in the simulation, rather than during job definition. A typical use for the CompoundStorageService is to select a definitive SimpleStorageService for each action of a job during its scheduling in a BatchScheduler class. This should never receive messages for I/O operations, as any standard storage service (File Read/Write/Delete/Copy/Lookup requests), instead, it overides the main functions of StorageService (readFile / writeFile /…) and will craft messages intended for one or many of its underlying storage services.
Public Functions
Constructor.
- Parameters:
hostname – the name of the host on which this service will run
storage_services – subordinate storage services
allocate – the storage allocation strategy
property_list – the configurable properties
messagepayload_list – the configurable message payloads
Constructor for the case where no request message (for I/O operations) should ever reach the CompoundStorageService. This use case suppose that any action making use of a FileLocation referencing this CompoundStorageService will be intercepted before its execution (in a scheduler for instance) and updated with one of the StorageServices known to this CompoundStorageService.
- Parameters:
hostname – the name of the host on which this service will run
storage_services – subordinate storage services
property_list – the configurable properties
messagepayload_list – the configurable message payloads
Copy file from a SimpleStorageService to a CSS. Src file cannot be stripped, but copy might result in stripped file on CSS.
- Parameters:
src_location – the source location
dst_location – the destination location
Copy file from css to a simple storage service (file might be stripped within the CSS, but should be reassembled on the SSS)
- Parameters:
src_location – the source location
dst_location – the destination location
Create a file at the storage service (in zero simulated time)
- Parameters:
file – a file
Create a file at the storage service (in zero simulated time)
- Parameters:
file – a file
path – a path
Create a file at the storage service (in zero simulated time)
- Parameters:
location – a location
-
void createFile(const std::shared_ptr<FileLocation> &location) = 0
Create a file at the storage service (in zero simulated time)
- Parameters:
location – a location
Delete a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
Delete a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
path – a path
Delete a file at the storage service (incurs simulated overheads)
- Parameters:
location – a location
Delete a file on the storage service.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location to delete
wait_for_answer – whether this call should
-
virtual void deleteFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, bool wait_for_answer) override
Delete a file on the storage service.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location to delete
wait_for_answer – whether this call should
-
std::map<std::string, std::vector<std::shared_ptr<wrench::StorageService>>> &getAllServices()
Method to return the collection of known StorageServices.
Return the set of all services accessible through this CompoundStorageService.
- Returns:
The set of known StorageServices.
-
inline virtual double getBufferSize() const override
Determine the storage service’s buffer size.
- Returns:
a size in bytes
Get a file’s last write date at a location (in zero simulated time)
- Parameters:
location – the location
- Returns:
a date in seconds, or -1 if the file is not found
-
virtual double getLoad() override
Get the load (number of concurrent reads) on the storage service Not implemented yet for CompoundStorageService (is it needed?)
- Returns:
the load on the service (currently throws)
-
virtual double getTotalFreeSpaceAtPath(const std::string &path) override
Synchronously asks the storage services inside the compound storage service for their free space at all of their mount points.
- Parameters:
path – a path
- Throws:
- Returns:
The free space in bytes at the path
-
virtual double getTotalSpace() override
Get the total space across all internal services known by the CompoundStorageService.
- Parameters:
path – the path
- Returns:
A number of bytes
Determines whether a file is present at the storage service (in zero simulated time)
- Parameters:
file – a file
- Returns:
true if the file is present, false otherwise
Determines whether a file is present at the storage service (in zero simulated time)
- Parameters:
file – a file
path – a path
- Returns:
true if the file is present, false otherwise
Check (outside of simulation time) whether the storage service has a file.
- Parameters:
location – a location
- Returns:
true if the file is present, false otherwise
-
bool hasFile(const std::shared_ptr<FileLocation> &location) = 0
Determines whether a file is present at the storage service (in zero simulated time)
- Parameters:
location – a location
- Returns:
true if the file is present, false otherwise
-
inline virtual bool isBufferized() const override
Determine whether the storage service is bufferized.
- Returns:
true if bufferized, false otherwise
Lookup whether a file exists on the storage service (incurs simulated overheads)
- Parameters:
file – a file
- Returns:
true if the file is present, or false
Lookup whether a file exists on the storage service (incurs simulated overheads)
- Parameters:
file – a file
path – a path
- Returns:
true if the file is present, or false
Lookup whether a file exists at a location on the storage service (incurs simulated overheads)
- Parameters:
location – a location
- Returns:
true if the file is present, or false
Asks the storage service whether it holds a file.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location to lookup
- Returns:
true if the file is present, false otherwise
-
virtual bool lookupFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location) override
Asks the storage service whether it holds a file.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location to lookup
- Returns:
true if the file is present, false otherwise
Lookup for a DataFile in the internal file mapping of the CompoundStorageService (a simplified FileRegistry)
- Parameters:
file – the file of interest
answer_commport – the answer commport to which the reply from the server should be sent
- Returns:
A vector of shared_ptr on a FileLocation if the DataFile is known to the CompoundStorageService or empty vector if it’s not.
Lookup for a FileLocation (using its internal DataFile) in the internal file mapping of the CompoundStorageService (a simplified FileRegistry)
- Parameters:
location – the location of interest
- Returns:
A shared_ptr on a FileLocation if the DataFile is known to the CompoundStorageService or nullptr if it’s not.
Lookup for a FileLocation (using its internal DataFile) in the internal file mapping of the CompoundStorageService, and if it is not found, try to allocate the file on one of the underlying storage services, using the user-provided ‘storage_selection’ callback.
- Parameters:
location – the location of interest
- Returns:
A shared_ptr on a FileLocation if the DataFile is known to the CompoundStorageService or could be allocated or nullptr if it’s not.
Lookup for a FileLocation (using its internal DataFile) in the internal file mapping of the CompoundStorageService, and if it is not found, try to allocate the file on one of the underlying storage services, using the user-provided ‘storage_selection’ callback.
- Parameters:
location – the location of interest
stripe_count – number of stripes required for the given file (overrides any global setting)
- Returns:
A shared_ptr on a FileLocation if the DataFile is known to the CompoundStorageService or could be allocated or nullptr if it’s not.
Read a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
Read a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
path – a path
Read a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
path – a path
num_bytes – a number of bytes to read
Read a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
num_bytes – a number of bytes to read
Read a file at the storage service (incurs simulated overheads)
- Parameters:
location – a location
Read a file at the storage service (incurs simulated overheads)
- Parameters:
location – a location
num_bytes – a number of bytes to read
Read a file from the storage service.
- Parameters:
answer_commport – the commport on which to expect the answer
location – the location
num_bytes – the number of bytes to read
wait_for_answer – whether to wait for the answer
-
virtual void readFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, double num_bytes, bool wait_for_answer) override
Read a file from the storage service.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location
num_bytes – the number of bytes to read
wait_for_answer – whether to wait for the answer
-
inline virtual void removeDirectory(const std::string &path) override
Remove a directory and all its content at the storage service (in zero simulated time)
- Parameters:
path – a path
Remove a file at the storage service (in zero simulated time)
- Parameters:
location – a location
Reserve space at the storage service.
- Parameters:
location – a location
- Returns:
true if success, false otherwise
-
virtual void setIsScratch(bool is_scratch) override
setIsScratch can’t be used on a CompoundStorageService because it doesn’t have any actual storage resources.
- Parameters:
is_scratch – true or false
- Throws:
std::logic_error –
Unreserve space at the storage service.
- Parameters:
location – a location
Write a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
Write a file at the storage service (incurs simulated overheads)
- Parameters:
file – a file
path – a path
Write a file at the storage service (incurs simulated overheads)
- Parameters:
location – a location
Synchronously write a file to the storage service.
- Parameters:
answer_commport – the commport on which to expect the answer
location – the location
num_bytes_to_write – the number of bytes to write to the file
wait_for_answer – whether to wait for the answer
- Throws:
-
virtual void writeFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, double num_bytes_to_write, bool wait_for_answer) override
Synchronously write a file to the storage service.
- Parameters:
answer_commport – the answer commport to which the reply from the server should be sent
location – the location
num_bytes_to_write – number of bytes to write to the file
wait_for_answer – whether to wait for the answer
- Throws:
Public Members
-
std::map<std::string, AllocationTrace> copy_traces = {}
File copy traces.
-
std::map<std::string, AllocationTrace> delete_traces = {}
File delete traces.
-
std::vector<std::pair<double, AllocationTrace>> internal_storage_use = {}
Internal storage use.
-
std::map<std::string, AllocationTrace> write_traces = {}
File read traces.
File write traces
Public Static Functions
Intended to be called by StorageService::copyFile() when the use of a CSS is detected in a file copy.
Synchronously copy a file.
- Parameters:
src_location – the source location
dst_location – the destination location