wrench::StorageService

class StorageService : public wrench::Service

The storage service base class.

Subclassed by wrench::CompoundStorageService, wrench::SimpleStorageService, wrench::StorageServiceProxy, wrench::XRootD::Node

Public Functions

inline void createFile(const std::shared_ptr<DataFile> &file)

Create a file at the storage service (in zero simulated time)

Parameters:

file – a file

inline virtual void createFile(const std::shared_ptr<DataFile> &file, const std::string &path)

Create a file at the storage service (in zero simulated time)

Parameters:
  • file – a file

  • path – a path

virtual void createFile(const std::shared_ptr<FileLocation> &location) = 0

Create a file at the storage service (in zero simulated time)

Parameters:

location – a location

inline virtual void decrementNumRunningOperationsForLocation(const std::shared_ptr<FileLocation> &location)

Decrement the number of operations for a location.

Parameters:

location – a location

inline void deleteFile(const std::shared_ptr<DataFile> &file)

Delete a file at the storage service (incurs simulated overheads)

Parameters:

file – a file

inline virtual void deleteFile(const std::shared_ptr<DataFile> &file, const std::string &path)

Delete a file at the storage service (incurs simulated overheads)

Parameters:
  • file – a file

  • path – a path

inline virtual void deleteFile(const std::shared_ptr<FileLocation> &location)

Delete a file at the storage service (incurs simulated overheads)

Parameters:

location – a location

virtual void deleteFile(simgrid::s4u::Mailbox *answer_mailbox, const std::shared_ptr<FileLocation> &location, bool wait_for_answer)

Delete a file on the storage service.

Parameters:
  • answer_mailbox – the answer mailbox to which the reply from the server should be sent

  • location – the location to delete

  • wait_for_answer – whether this call should

inline virtual std::string getBaseRootPath()

Get the storage’s service base root path.

Returns:

a path

virtual double getBufferSize() const = 0

Determine the storage service’s buffer size.

Returns:

a size in bytes

inline double getFileLastWriteDate(const std::shared_ptr<DataFile> &file)

Get a file’s last write date at the storage service (in zero simulated time)

Parameters:

file – a file

Returns:

a date in seconds

inline virtual double getFileLastWriteDate(const std::shared_ptr<DataFile> &file, const std::string &path)

Get a file’s last write date at the storage service (in zero simulated time)

Parameters:
  • file – a file

  • path – a path

Returns:

a date in seconds

virtual double getFileLastWriteDate(const std::shared_ptr<FileLocation> &location) = 0

Get a file’s last write date at the storage service (in zero simulated time)

Parameters:

location – a location

Returns:

a date in seconds

inline double getFileLocationLastWriteDate(const std::shared_ptr<FileLocation> &location)

Get a file’s last write date at a location (in zero simulated time)

File write date methods

Parameters:

location – a location

Returns:

a date in seconds, or -1 if the file is not found

virtual double getLoad() = 0

Get the storage service’s load.

Service load methods

Returns:

a load metric

double getTotalFreeSpace()

Get the storage service’s total free space (incurs simulated overhead)

Synchronously asks the storage service for its total free space capacity, that is, the total capacity at the “/” path. Note that this doesn’t mean that that free space could be used to store a single file, as the storage service may have file systems at multiple mount points, may me a front-end for a set of storage systems, etc.

Service free space method

Returns:

a capacity in bytes

Returns:

A number of bytes

virtual double getTotalFreeSpaceAtPath(const std::string &path)

Get the storage service’s free space at a path (incurs simulated overhead)

Synchronously asks the storage service for its total free space capacity at a particular path. Note that this doesn’t mean that that free space could be used to store a single file, as the storage service may have file systems at multiple mount points, may be a front-end for a set of storage systems, etc.

Service free space method

path a path

Parameters:

path – a path (if empty, “/” will be used)

Returns:

a capacity in bytes

Returns:

A number of bytes

virtual double getTotalSpace() = 0

Get the storage service’s total space (in zero simulated time)

Service total space method

Returns:

a capacity in bytes

inline bool hasFile(const std::shared_ptr<DataFile> &file)

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

inline virtual bool hasFile(const std::shared_ptr<DataFile> &file, const std::string &path)

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

virtual 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 void incrementNumRunningOperationsForLocation(const std::shared_ptr<FileLocation> &location)

Increment the number of operations for a location.

Parameters:

location – a location

virtual bool isBufferized() const = 0

Determine whether the storage service is bufferized.

Returns:

true if bufferized, false otherwise

inline bool isScratch() const

Determines whether the storage service is a scratch service of a ComputeService.

Returns:

true if it is, false otherwise

inline bool lookupFile(const std::shared_ptr<DataFile> &file)

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

inline virtual bool lookupFile(const std::shared_ptr<DataFile> &file, const std::string &path)

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

inline virtual bool lookupFile(const std::shared_ptr<FileLocation> &location)

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

virtual bool lookupFile(simgrid::s4u::Mailbox *answer_mailbox, const std::shared_ptr<FileLocation> &location)

Asks the storage service whether it holds a file.

Parameters:
  • answer_mailbox – the answer mailbox to which the reply from the server should be sent

  • location – the location to lookup

Returns:

true if the file is present, false otherwise

inline void readFile(const std::shared_ptr<DataFile> &file)

Read a file at the storage service (incurs simulated overheads)

Parameters:

file – a file

inline virtual void readFile(const std::shared_ptr<DataFile> &file, const std::string &path)

Read a file at the storage service (incurs simulated overheads)

Parameters:
  • file – a file

  • path – a path

inline virtual void readFile(const std::shared_ptr<DataFile> &file, const std::string &path, double num_bytes)

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

inline void readFile(const std::shared_ptr<DataFile> &file, double num_bytes)

Read a file at the storage service (incurs simulated overheads)

Parameters:
  • file – a file

  • num_bytes – a number of bytes to read

inline void readFile(const std::shared_ptr<FileLocation> &location)

Read a file at the storage service (incurs simulated overheads)

Parameters:

location – a location

inline virtual void readFile(const std::shared_ptr<FileLocation> &location, double num_bytes)

Read a file at the storage service (incurs simulated overheads)

Parameters:
  • location – a location

  • num_bytes – a number of bytes to read

virtual void readFile(simgrid::s4u::Mailbox *answer_mailbox, const std::shared_ptr<FileLocation> &location, double num_bytes, bool wait_for_answer)

Read a file from the storage service.

Parameters:
  • answer_mailbox – the mailbox 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) = 0

Remove a directory and all files at the storage service (in zero simulated time)

Parameters:

path – a path

inline void removeFile(const std::shared_ptr<DataFile> &file)

Remove a file at the storage service (in zero simulated time)

Parameters:

file – a file

inline virtual void removeFile(const std::shared_ptr<DataFile> &file, const std::string &path)

Remove a file at the storage service (in zero simulated time)

Parameters:
  • file – a file

  • path – a path

virtual void removeFile(const std::shared_ptr<FileLocation> &location) = 0

Remove a file at the storage service (in zero simulated time)

Parameters:

location – a location

virtual bool reserveSpace(std::shared_ptr<FileLocation> &location) = 0

Reserve space at the storage service.

Parameters:

location – a location

Returns:

true if success, false otherwise

virtual void stop() override

Stop the servier.

Stop the service.

inline virtual double traceTotalFreeSpace()

Get the storage service’s total free space (no simulated overhead)

Service free space tracing (doesn’t incur simulated overhead)

Returns:

Current free space in bytes

virtual void unreserveSpace(std::shared_ptr<FileLocation> &location) = 0

Unreserve space at the storage service.

Parameters:

location – a location

inline void writeFile(const std::shared_ptr<DataFile> &file)

Write a file at the storage service (incurs simulated overheads)

Parameters:

file – a file

inline virtual void writeFile(const std::shared_ptr<DataFile> &file, const std::string &path)

Write a file at the storage service (incurs simulated overheads)

Parameters:
  • file – a file

  • path – a path

inline virtual void writeFile(const std::shared_ptr<FileLocation> &location)

Write a file at the storage service (incurs simulated overheads)

Parameters:

location – a location

virtual void writeFile(simgrid::s4u::Mailbox *answer_mailbox, const std::shared_ptr<FileLocation> &location, bool wait_for_answer)

Synchronously write a file to the storage service.

Parameters:
  • answer_mailbox – the mailbox on which to expect the answer

  • location – the location

  • wait_for_answer – whether to wait for the answer

Throws:

ExecutionException

Public Static Functions

static void copyFile(const std::shared_ptr<FileLocation> &src_location, const std::shared_ptr<FileLocation> &dst_location)

Copy a file from one location to another.

Synchronously ask the storage service to read a file from another storage service.

Parameters:
  • src_location – a source location

  • dst_location – a destination location

  • src_location – the location where to read the file

  • dst_location – the location where to write the file

Throws:
static inline void createFileAtLocation(const std::shared_ptr<FileLocation> &location)

Create a file at a location (in zero simulated time)

File creation methods

Parameters:

location – a location

static inline void deleteFileAtLocation(const std::shared_ptr<FileLocation> &location)

Delete a file at a location (incurs simulated overheads)

File deletion methods

Parameters:

location – a location

static inline bool hasFileAtLocation(const std::shared_ptr<FileLocation> &location)

Determines whether a file is present at a location (in zero simulated time)

Non-Simulation methods File lookup methods

Parameters:

location – a location

Returns:

true if the file is present, false otherwise

static void initiateFileCopy(simgrid::s4u::Mailbox *answer_mailbox, const std::shared_ptr<FileLocation> &src_location, const std::shared_ptr<FileLocation> &dst_location)

Initiate a file copy from one location to another.

Asynchronously ask for a file copy between two storage services.

Parameters:
  • answer_mailbox – a mailbox on which to receive completion/failure notification

  • src_location – a source location

  • dst_location – a destination location

  • answer_mailbox – the mailbox to which a notification message will be sent

  • src_location – the source location

  • dst_location – the destination location

Throws:
static inline bool lookupFileAtLocation(const std::shared_ptr<FileLocation> &location)

Lookup whether a file exists at a location (incurs simulated overheads)

File Lookup methods (in simulation)

Parameters:

location – a location

Returns:

true if the file is present at the location, or false

static inline void readFileAtLocation(const std::shared_ptr<FileLocation> &location)

Read a file at a location (incurs simulated overheads)

File read methods

Parameters:

location – a location

static inline void readFileAtLocation(const std::shared_ptr<FileLocation> &location, double num_bytes)

Read a file at a location (incurs simulated overheads)

Parameters:
  • location – a location

  • num_bytes – a number of bytes to read

static void readFiles(std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> locations)

Helper method to read multiple files.

Synchronously and sequentially read a set of files from storage services.

Parameters:
  • locations – a map of files to locations

  • locations – a map of files to locations

Throws:
static inline void removeFileAtLocation(const std::shared_ptr<FileLocation> &location)

Remove a file at a location (in zero simulated time)

File removal methods

Parameters:

location – a location

static inline void writeFileAtLocation(const std::shared_ptr<FileLocation> &location)

Write a file at a location (incurs simulated overheads)

File write methods

Parameters:

location – a location

static void writeFiles(std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> locations)

Helper method to write multiple files.

Synchronously and sequentially upload a set of files from storage services.

Parameters:
  • locations – a map of files to locations

  • locations – a map of files to locations

Throws: