SimGrid
3.21
Versatile Simulation of Distributed Systems
|
A simulated file.
Used to simulate the time it takes to access to a file, but does not really store any information.
They are located on simgrid::s4u::Storage that are accessed from a given simgrid::s4u::Host through mountpoints. For now, you cannot change the mountpoints programatically, and must declare them from your platform file.
#include <file_system.h>
Public Member Functions | |
File (std::string fullpath, void *userdata) | |
File (std::string fullpath, sg_host_t host, void *userdata) | |
~File () | |
const char * | get_path () |
Retrieves the path to the file. More... | |
sg_size_t | read (sg_size_t size) |
Simulates a local read action. More... | |
sg_size_t | write (sg_size_t size) |
Simulates a write action. More... | |
void | set_userdata (void *data) |
Allows to store user data on that host. More... | |
void * | get_userdata () |
Retrieves the previously stored data. More... | |
sg_size_t | size () |
void | seek (sg_offset_t pos) |
void | seek (sg_offset_t pos, int origin) |
Sets the file head to the given position. More... | |
sg_size_t | tell () |
Sets the file head to the given position from a given origin. More... | |
void | move (std::string fullpath) |
Retrieves the current file position. More... | |
int | remote_copy (sg_host_t host, const char *fullpath) |
int | remote_move (sg_host_t host, const char *fullpath) |
int | unlink () |
void | dump () |
Remove a file from the contents of a disk. More... | |
Public Attributes | |
int | desc_id = 0 |
Storage * | local_storage_ |
std::string | mount_point_ |
simgrid::s4u::File::File | ( | std::string | fullpath, |
void * | userdata | ||
) |
simgrid::s4u::File::File | ( | std::string | fullpath, |
sg_host_t | host, | ||
void * | userdata | ||
) |
simgrid::s4u::File::~File | ( | ) |
|
inline |
Retrieves the path to the file.
sg_size_t simgrid::s4u::File::read | ( | sg_size_t | size | ) |
Simulates a local read action.
Returns the size of data actually read
sg_size_t simgrid::s4u::File::write | ( | sg_size_t | size | ) |
Simulates a write action.
Write into a file (local or remote)
Returns the size of data actually written.
size | of the file to write |
|
inline |
Allows to store user data on that host.
|
inline |
Retrieves the previously stored data.
sg_size_t simgrid::s4u::File::size | ( | ) |
void simgrid::s4u::File::seek | ( | sg_offset_t | pos | ) |
void simgrid::s4u::File::seek | ( | sg_offset_t | pos, |
int | origin | ||
) |
Sets the file head to the given position.
sg_size_t simgrid::s4u::File::tell | ( | ) |
Sets the file head to the given position from a given origin.
void simgrid::s4u::File::move | ( | std::string | fullpath | ) |
Retrieves the current file position.
Rename a file. WARNING: It is forbidden to move the file to another mount point
int simgrid::s4u::File::remote_copy | ( | sg_host_t | host, |
const char * | fullpath | ||
) |
int simgrid::s4u::File::remote_move | ( | sg_host_t | host, |
const char * | fullpath | ||
) |
int simgrid::s4u::File::unlink | ( | ) |
void simgrid::s4u::File::dump | ( | ) |
Remove a file from the contents of a disk.
int simgrid::s4u::File::desc_id = 0 |
Storage* simgrid::s4u::File::local_storage_ |
std::string simgrid::s4u::File::mount_point_ |