wrench::XRootD::Node

class Node : public wrench::StorageService

An XRootD node, this can be either a supervisor or a storage server. All nodes are classified as storage services even though not all have physical storage Unless a node is also has an internal storage service, some normal storage service messages will error out. Only File Read, locate, and delete are supported at this time, anything else requires talking directly to a specific file server with physical storage. Nodes not directly be created, instead an XRootD Metavisor should create them.

Public Functions

Node(Deployment *deployment, const std::string &hostname, WRENCH_PROPERTY_COLLECTION_TYPE storage_property_list, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE storage_messagepayload_list)

Constructor, should not be used directly except by XRootD createNode.

Parameters:
  • deployment – the XRootD deployment this node belongs to

  • hostname – the name of the host on which the service and its storage service should run

  • property_list – A property list

  • messagepayload_list – A Message Payload list

std::shared_ptr<Node> addChildStorageServer(const std::string &hostname, const std::string &mount_point, WRENCH_PROPERTY_COLLECTION_TYPE storage_property_list = {}, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE storage_messagepayload_list = {}, WRENCH_PROPERTY_COLLECTION_TYPE node_property_list = {}, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE node_messagepayload_list = {})

Adds a child, which will be a storage server, to a node.

Parameters:
  • hostname – the name of the host on which the child will run

  • mount_point – the mount point at that host

  • storage_property_list – the storage server’s property list

  • storage_messagepayload_list – the storage server’s message payload list

  • node_property_list – the XRootD node’s property list

  • node_messagepayload_list – the XRootD node’s message payload list

Returns:

The child

std::shared_ptr<Node> addChildSupervisor(const std::string &hostname)

Adds a child, which will be a supervisor, to a node.

Parameters:

hostname – the name of the host on which the child will run

Returns:

The child

bool cached(shared_ptr<DataFile> file)

Check the cache for a file.

Parameters:

file – The file to check the cache for

Returns:

true if the file is cached, false otherwise

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

create a new file in the federation on this node. Use instead of wrench::Simulation::createFile when adding files to XRootD

Parameters:

location – a file location, must be the same object as the function is invoked on

Throws:

std::invalid_argument

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

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

Parameters:

location – a location

void deleteFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, bool wait_for_answer)

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

Determine the storage service’s buffer size.

Returns:

a size in bytes

std::set<std::shared_ptr<FileLocation>> getCached(shared_ptr<DataFile> file)

Get all cached locations of the file.

Parameters:

file – The file to check the cache for

Returns:

A set of valid cached files. Empty set if none are cached

std::shared_ptr<Node> getChild(unsigned int n)

A meta tree traversal operation to get the nth child of this node.

Parameters:

n – The index of the child to receive. Nodes are in order added

Returns:

the Child Nodes shared pointer, or nullptr if this node is a leaf

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

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

Parameters:

location – the file location

Returns:

the file’s last write date, or -1 if the file is not found

virtual double getLoad() override

Get the load of the underlying storage service.

Returns:

the load on the service

Node *getParent()

A Meta tree traversal to get the parent of this node.

Returns:

pointer supervisor. Will be nullptr if root

std::shared_ptr<SimpleStorageService> getStorageServer()

Gets the underlying storage server.

Returns:

A pointer to the simple storage server for this file server

virtual double getTotalSpace() override

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

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

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

virtual bool isBufferized() const override

Determine whether the storage service is bufferized.

Returns:

true if bufferized, 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 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 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

bool lookupFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location)

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

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

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

Parameters:

file – a file

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

void readFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, double num_bytes, bool wait_for_answer)

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 its content at the Node (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 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) override

remove a new file in the federation on this node.

Parameters:

location – a file location, must be the same object as the function is invoked on

Throws:

std::invalid_argument

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

Reserve space at the storage service.

Parameters:

location – a location

Returns:

true if success, false otherwise

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

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

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

Parameters:

location – a location

void writeFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, double num_bytes_to_write, bool wait_for_answer)

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:

ExecutionException

virtual void writeFile(S4U_CommPort *answer_commport, const std::shared_ptr<FileLocation> &location, double num_bytes_to_write, bool wait_for_answer) override

@brief write a file on this node.

Parameters:
  • answer_commport – a commport on which to send the answer messagej

  • location – a location

  • wait_for_answer – true if this method should wait for the answer, false otherwise

    @throw std::invalid_argument