SimGrid  3.14.159
Versatile Simulation of Distributed Systems
simgrid::s4u::File Class Reference

Detailed Description

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

Public Member Functions

 File (const char *fullpath, void *userdata)
 
 ~File ()
 
const char * path ()
 Retrieves the path to the file. More...
 
sg_size_t read (sg_size_t size)
 Simulates a read action. More...
 
sg_size_t write (sg_size_t size)
 Simulates a write action. More...
 
void setUserdata (void *data)
 Allows to store user data on that host. More...
 
voiduserdata ()
 Retrieves the previously stored data. More...
 
sg_size_t size ()
 Retrieve the datasize. More...
 
void seek (sg_size_t pos)
 Sets the file head to the given position. More...
 
sg_size_t tell ()
 Retrieves the current file position. More...
 
void move (const char *fullpath)
 Rename a file. More...
 
void unlink ()
 Remove a file from disk. More...
 

Constructor & Destructor Documentation

§ File()

simgrid::s4u::File::File ( const char *  fullpath,
void userdata 
)

§ ~File()

simgrid::s4u::File::~File ( )

Member Function Documentation

§ path()

const char* simgrid::s4u::File::path ( )
inline

Retrieves the path to the file.

§ read()

sg_size_t simgrid::s4u::File::read ( sg_size_t  size)

Simulates a read action.

Returns the size of data actually read

FIXME: reading from a remotely mounted disk is not implemented yet. Any storage is considered as local, and no network communication ever occur.

§ write()

sg_size_t simgrid::s4u::File::write ( sg_size_t  size)

Simulates a write action.

Returns the size of data actually written.

FIXME: reading from a remotely mounted disk is not implemented yet. Any storage is considered as local, and no network communication ever occur.

§ setUserdata()

void simgrid::s4u::File::setUserdata ( void data)
inline

Allows to store user data on that host.

§ userdata()

void* simgrid::s4u::File::userdata ( )
inline

Retrieves the previously stored data.

§ size()

sg_size_t simgrid::s4u::File::size ( )

Retrieve the datasize.

§ seek()

void simgrid::s4u::File::seek ( sg_size_t  pos)

Sets the file head to the given position.

§ tell()

sg_size_t simgrid::s4u::File::tell ( )

Retrieves the current file position.

§ move()

void simgrid::s4u::File::move ( const char *  fullpath)

Rename a file.

WARNING: It is forbidden to move the file to another mount point

§ unlink()

void simgrid::s4u::File::unlink ( )

Remove a file from disk.


The documentation for this class was generated from the following files: