wrench::StorageServiceProxy
-
class StorageServiceProxy : public wrench::StorageService
Implementation of a storage service proxy.
Public Functions
Constructor.
- Parameters:
hostname – The host to run on
cache – A Storage server to use as a cache. Ideal on the same host
default_remote – A remote file server to use as a default target. Defaults to nullptr
properties – The wrench property overrides
message_payloads – The wrench message payload overrides
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
StorageServiceProxy.createFile() is ambiguous where the file should go. You should call createFile on the remote service where you wish to create the file. If you want it to start cached, you should also call StorageServiceProxy.getCache().createFile.
- Parameters:
location – the file 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.
- Parameters:
targetServer – the target server
file – the file
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 double getBufferSize() const override
Get the buffer size of the cache (which could be 0 or >0), or 0 if there is no cache.
- Returns:
a size in bytes
-
std::shared_ptr<StorageService> getCache()
Get the proxy’s associated cache.
- Returns:
the cache storage service
Get the last write date of a file.
Forward to remote server.
- Parameters:
location – the file location
- Returns:
a (simulated) date in seconds
-
virtual double getLoad() override
Get the load of the cache
- Returns:
the load of the cache
-
virtual double getTotalFreeSpaceAtPath(const std::string &path) override
Synchronously asks the proxy service for its capacity (which returns the remote)
- Parameters:
path – the path
- Returns:
The free space in bytes of each mount point, as a map
-
virtual double getTotalSpace() override
Synchronously asks the proxy service for its total capacity (which returns the remote)
- Returns:
The free space in bytes of each mount point, as a map
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
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
-
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
-
virtual bool isBufferized() const override
Returns true if the cache is bufferized, false otherwise.
- Returns:
true or false
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
Lookup a file.
- Parameters:
targetServer – the target server
file – the file
- Returns:
true if the file is present, false otherwise
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 int main() override
Main method of the daemon.
- Returns:
0 on termination
-
bool processNextMessage()
Process a received control message.
- Returns:
false if the daemon should terminate
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.
- Parameters:
targetServer – the target server
file – the file
Read a file.
- Parameters:
targetServer – the target server
file – the file
path – the file path
Read a file.
- Parameters:
targetServer – the target server
file – the file
path – the file path
num_bytes – the number of bytes to read
Read a file.
- Parameters:
targetServer – the target server
file – the file
num_bytes – the 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
Detect if a remote file read is already in process for this file. If it is, return true.
- Parameters:
file – the file to find
- Returns:
True if the message was processed. False otherwise
-
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
StorageServiceProxy.removeFile() is ambiguous where the file should go. You should call removeFile on the remote service where you wish to remove the file. If you want it to start cached, you should also call StorageServiceProxy.getCache().removeFile.
- Parameters:
location – the file location
Reserve space at the storage service.
- Parameters:
location – a location
- Returns:
true if success, false otherwise
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
Write a file.
- Parameters:
targetServer – the target server
file – the file
Write a file.
- Parameters:
targetServer – the target server
file – the file
path – the file path
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:
Public Static Functions
Factory to create a StorageServiceProxy that does not cache reads, and only forwards requests to another service.
- Parameters:
hostname – hostname
default_remote – The StorageService to use as a remote file source
properties – Properties for the fileServiceProxy
message_payloads – Message Payloads for the fileServiceProxy
- Returns:
the StorageServiceProxy created
-
static inline std::shared_ptr<StorageServiceProxy> createCachelessRedirectProxy(const std::string &hostname, WRENCH_PROPERTY_COLLECTION_TYPE properties = {}, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE message_payloads = {})
Factory to create a StorageServiceProxy that does not cache reads, and does not have a default destination to forward too.
- Parameters:
hostname – hostname
properties – Properties for the fileServiceProxy
message_payloads – Message Payloads for the fileServiceProxy
- Returns:
the StorageServiceProxy created
Factory to create a StorageServiceProxy that can a default destination to forward requests too, and will cache requests as they are made.
- Parameters:
hostname – hostname
cache – The StorageService to use as a Cache
remote – The StorageService to use as a remote file source
properties – Properties for the fileServiceProxy
message_payloads – Message Payloads for the fileServiceProxy
- Returns:
the StorageServiceProxy created