SimGrid  3.16
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.

Examples:
examples/s4u/actions-storage/s4u_actions-storage.cpp.

#include <File.hpp>

Public Member Functions

 File (const char *fullpath, void *userdata)
 
 File (const char *fullpath, sg_host_t host, 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...
 
sg_size_t write (sg_size_t size, sg_host_t host)
 
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...
 
void unlink (sg_host_t host)
 

Public Attributes

const char * storage_type
 
const char * storageId
 
std::string mount_point
 
int desc_id = 0
 

Constructor & Destructor Documentation

◆ File() [1/2]

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

◆ File() [2/2]

simgrid::s4u::File::File ( const char *  fullpath,
sg_host_t  host,
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.

Examples:
examples/s4u/actions-storage/s4u_actions-storage.cpp.

◆ write() [1/2]

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

Simulates a write action.

Returns the size of data actually written.

◆ write() [2/2]

sg_size_t simgrid::s4u::File::write ( sg_size_t  size,
sg_host_t  host 
)

◆ 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() [1/2]

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

Remove a file from disk.

◆ unlink() [2/2]

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

Member Data Documentation

◆ storage_type

const char* simgrid::s4u::File::storage_type

◆ storageId

const char* simgrid::s4u::File::storageId

◆ mount_point

std::string simgrid::s4u::File::mount_point

◆ desc_id

int simgrid::s4u::File::desc_id = 0

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