wrench::SimpleStorageService
-
class SimpleStorageService : public wrench::StorageService
A storage service that provides direct access to some storage resources (e.g., one or more disks). An important (configurable) property of the storage service is SimpleStorageServiceProperty::BUFFER_SIZE (see documentation thereof), which defines the buffer size that the storage service uses. Specifically, when the storage service receives/sends data from/to the network, it does so in a loop over data “chunks”, with pipelined network and disk I/O operations. The smaller the buffer size the more “fluid” the model, but the more time-consuming the simulation. A large buffer size, however, may lead to less realistic simulations. At the extreme, an infinite buffer size would correspond to fully sequential executions (first a network receive/send, and then a disk write/read). Setting the buffer size to “0” corresponds to a fully fluid model in which individual data chunk operations are not simulated, thus achieving both accuracy (unless one specifically wishes to study the effects of buffering) and quick simulation times. For now, setting the buffer size to “0” is not implemented. The default buffer size is 10 MiB (note that the user can always declare a disk with arbitrary bandwidth in the platform description XML).
Subclassed by wrench::SimpleStorageServiceBufferized, wrench::SimpleStorageServiceNonBufferized
Public Functions
-
~SimpleStorageService() override
Destructor.
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 std::string getBaseRootPath() override
Get the base root path. Note that if this service has multiple mount points, this method will throw an exception.
- Returns:
-
inline virtual sg_size_t getBufferSize() const override
Determine the storage service’s buffer size.
- Returns:
a size in bytes
-
simgrid::s4u::Disk *getDiskForPathOrNull(const std::string &path)
Gets the disk that stores a path.
- Parameters:
path – a path
- Returns:
a disk, or nullptr if path is invalid
Get a file’s last write date at a location (in zero simulated time)
- Parameters:
file – the file
path – the path
- Returns:
the file’s last write date, or -1 if the file is not found or if the path is invalid
Get a file’s last write date at a the storage service (in zero simulated time)
- Parameters:
location – a location
- Returns:
a date in seconds, or -1 if the file is not found
-
inline virtual std::shared_ptr<simgrid::fsmod::FileSystem> getFileSystem() override
Retrieve the simple storage service’s file system object.
- Returns:
A file system
-
virtual std::string getMountPoint() override
Get the storage service’s mount point.
- Returns:
the mount points
-
virtual std::set<std::string> getMountPoints() override
Get the set of mount points.
- Returns:
the set of mount points
-
virtual unsigned long getTotalFilesZeroTime() override
Return current total number of files (in zero simulation time) for IO tracing purposes.
- Returns:
total number of files
-
virtual sg_size_t getTotalFreeSpaceZeroTime() override
Return current total free space from all mount point (in zero simulation time) for IO tracing purpose.
- Returns:
total free space in bytes
-
virtual sg_size_t getTotalSpace() override
Get the total static capacity of the storage service (in zero simulation time)
- Returns:
capacity of the storage service in 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
Determines whether the storage service has the file. This doesn’t simulate anything and is merely a zero-simulated-time data structure lookup. If you want to simulate the overhead of querying the StorageService, instead use lookupFile().
- 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
-
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()
Determine whether the storage service has multiple mount points.
- Returns:
true if multiple mount points, 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
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 removeDirectory(const std::string &path) override
Remove a directory and all files 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 (basically, add bytes to a hidden un-evictable file in zero time)
- Parameters:
location – a location
- Returns:
true if success, false otherwise
Unreserve space at the storage service (basically, remove bytes to a hidden un-evictable file in zero time)
- 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
Public Static Functions
-
static SimpleStorageService *createSimpleStorageService(const std::string &hostname, const std::set<std::string> &mount_points, WRENCH_PROPERTY_COLLECTION_TYPE property_list = {}, const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE &messagepayload_list = {})
Factory method to create SimpleStorageService instances.
- Parameters:
hostname – the name of the host on which to start the service
mount_points – the set of mount points
property_list – a property list ({} means “use all defaults”)
messagepayload_list – a message payload list ({} means “use all defaults”)
- Returns:
a pointer to a simple storage service
-
~SimpleStorageService() override