wrench::StorageService

class StorageService : public wrench::Service

The storage service base class.

Subclassed by wrench::CompoundStorageService, wrench::SimpleStorageService, 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 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

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

inline virtual double getTotalFilesZeroTime()

Get the number of files registered to the filesystem(s) associated with this service (no simulated overhead)

Service number of allocated files tracing (doesn’t incur simulated overhead)

Returns:

Current number of registered Datafile for all filesystem(s) from this service

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

inline virtual double getTotalFreeSpaceZeroTime()

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 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

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

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 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 void stop() override

Stop the servier.

Stop the service.

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

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 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: