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
-
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:
-
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
-
std::set<std::string> getMountPoints()
Get the set of mount points.
- Returns:
the set of mount points
-
inline std::string getPathMountPoint(const std::string &path)
Get the mount point that stores a path.
- Parameters:
path – path
- Returns:
a mount point
-
virtual double 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
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
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
-
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.
- Parameters:
location – a location
- Returns:
true if success, false otherwise
-
virtual double traceTotalFreeSpace() override
Return current total free space from all mount point (in zero simulation time) for IO tracing purpose.
- Returns:
total free space in bytes
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
Public Static Functions
-
static SimpleStorageService *createSimpleStorageService(const std::string &hostname, std::set<std::string> mount_points, WRENCH_PROPERTY_COLLECTION_TYPE property_list = {}, WRENCH_MESSAGE_PAYLOADCOLLECTION_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