SimGrid  3.16
Versatile Simulation of Distributed Systems
simgrid::surf::StorageImpl Class Referenceabstract

Detailed Description

SURF storage interface class.

A Storage represent a storage unit (e.g.: hard drive, usb key)

#include <StorageImpl.hpp>

Inheritance diagram for simgrid::surf::StorageImpl:
simgrid::surf::Resource simgrid::surf::PropertyHolder simgrid::surf::StorageN11

Public Member Functions

 StorageImpl (Model *model, const char *name, lmm_system_t maxminSystem, double bread, double bwrite, const char *type_id, const char *content_name, sg_size_t size, const char *attach)
 Storage constructor. More...
 
 ~StorageImpl () override
 
bool isUsed () override
 Check if the Storage is used (if an action currently uses its resources) More...
 
void apply_event (tmgr_trace_event_t event, double value) override
 Apply an event of external load event to that resource. More...
 
void turnOn () override
 Turn on the current Resource. More...
 
void turnOff () override
 Turn off the current Resource. More...
 
virtual StorageActionopen (const char *mount, const char *path)=0
 Open a file. More...
 
virtual StorageActionclose (surf_file_t fd)=0
 Close a file. More...
 
virtual StorageActionread (surf_file_t fd, sg_size_t size)=0
 Read a file. More...
 
virtual StorageActionwrite (surf_file_t fd, sg_size_t size)=0
 Write a file. More...
 
virtual std::map< std::string, sg_size_t > * getContent ()
 Get the content of the current Storage. More...
 
virtual sg_size_t getFreeSize ()
 Get the available size in bytes of the current Storage. More...
 
virtual sg_size_t getUsedSize ()
 Get the used size in bytes of the current Storage. More...
 
std::map< std::string, sg_size_t > * parseContent (const char *filename)
 
- Public Member Functions inherited from simgrid::surf::Resource
 Resource (Model *model, const char *name, lmm_constraint_t constraint)
 Constructor of LMM Resources. More...
 
virtual ~Resource ()
 
Modelmodel () const
 Get the Model of the current Resource. More...
 
const char * cname () const
 Get the name of the current Resource. More...
 
bool operator== (const Resource &other) const
 
virtual bool isOn () const
 Check if the current Resource is active. More...
 
virtual bool isOff () const
 Check if the current Resource is shut down. More...
 
lmm_constraint_t constraint () const
 Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) More...
 
- Public Member Functions inherited from simgrid::surf::PropertyHolder
 PropertyHolder ()
 
 ~PropertyHolder ()
 
const char * getProperty (const char *id)
 Return the property associated to the provided key (or nullptr if not existing) More...
 
void setProperty (const char *id, const char *value)
 Change the value of a given key in the property set. More...
 
xbt_dict_t getProperties ()
 Return the whole set of properties. More...
 

Static Public Member Functions

static StorageImplbyName (const char *name)
 
static std::unordered_map< std::string, StorageImpl * > * storagesMap ()
 

Public Attributes

s4u::Storage piface_
 Public interface. More...
 
std::map< std::string, sg_size_t > * content_
 
sg_size_t size_
 
sg_size_t usedSize_
 
std::string typeId_
 
std::string attach_
 
std::vector< StorageAction * > writeActions_
 
lmm_constraint_t constraintWrite_
 
lmm_constraint_t constraintRead_
 

Static Public Attributes

static std::unordered_map< std::string, StorageImpl * > * storages
 

Additional Inherited Members

- Protected Attributes inherited from simgrid::surf::Resource
const lmm_constraint_t constraint_ = nullptr
 

Constructor & Destructor Documentation

◆ StorageImpl()

simgrid::surf::StorageImpl::StorageImpl ( Model model,
const char *  name,
lmm_system_t  maxminSystem,
double  bread,
double  bwrite,
const char *  type_id,
const char *  content_name,
sg_size_t  size,
const char *  attach 
)

Storage constructor.

◆ ~StorageImpl()

simgrid::surf::StorageImpl::~StorageImpl ( )
override

Member Function Documentation

◆ byName()

StorageImpl * simgrid::surf::StorageImpl::byName ( const char *  name)
static

◆ isUsed()

bool simgrid::surf::StorageImpl::isUsed ( )
overridevirtual

Check if the Storage is used (if an action currently uses its resources)

Implements simgrid::surf::Resource.

◆ apply_event()

void simgrid::surf::StorageImpl::apply_event ( tmgr_trace_event_t  event,
double  value 
)
overridevirtual

Apply an event of external load event to that resource.

Parameters
eventWhat happened
value[TODO]

Implements simgrid::surf::Resource.

◆ turnOn()

void simgrid::surf::StorageImpl::turnOn ( )
overridevirtual

Turn on the current Resource.

Reimplemented from simgrid::surf::Resource.

◆ turnOff()

void simgrid::surf::StorageImpl::turnOff ( )
overridevirtual

Turn off the current Resource.

Reimplemented from simgrid::surf::Resource.

◆ open()

virtual StorageAction* simgrid::surf::StorageImpl::open ( const char *  mount,
const char *  path 
)
pure virtual

Open a file.

Parameters
mountThe mount point
pathThe path to the file
Returns
The StorageAction corresponding to the opening

Implemented in simgrid::surf::StorageN11.

◆ close()

virtual StorageAction* simgrid::surf::StorageImpl::close ( surf_file_t  fd)
pure virtual

Close a file.

Parameters
fdThe file descriptor to close
Returns
The StorageAction corresponding to the closing

Implemented in simgrid::surf::StorageN11.

◆ read()

virtual StorageAction* simgrid::surf::StorageImpl::read ( surf_file_t  fd,
sg_size_t  size 
)
pure virtual

Read a file.

Parameters
fdThe file descriptor to read
sizeThe size in bytes to read
Returns
The StorageAction corresponding to the reading

Implemented in simgrid::surf::StorageN11.

◆ write()

virtual StorageAction* simgrid::surf::StorageImpl::write ( surf_file_t  fd,
sg_size_t  size 
)
pure virtual

Write a file.

Parameters
fdThe file descriptor to write
sizeThe size in bytes to write
Returns
The StorageAction corresponding to the writing

Implemented in simgrid::surf::StorageN11.

◆ getContent()

std::map< std::string, sg_size_t > * simgrid::surf::StorageImpl::getContent ( )
virtual

Get the content of the current Storage.

Returns
A xbt_dict_t with path as keys and size in bytes as values

◆ getFreeSize()

sg_size_t simgrid::surf::StorageImpl::getFreeSize ( )
virtual

Get the available size in bytes of the current Storage.

Returns
The available size in bytes of the current Storage

◆ getUsedSize()

sg_size_t simgrid::surf::StorageImpl::getUsedSize ( )
virtual

Get the used size in bytes of the current Storage.

Returns
The used size in bytes of the current Storage

◆ parseContent()

std::map< std::string, sg_size_t > * simgrid::surf::StorageImpl::parseContent ( const char *  filename)

◆ storagesMap()

static std::unordered_map<std::string, StorageImpl*>* simgrid::surf::StorageImpl::storagesMap ( )
inlinestatic

Member Data Documentation

◆ piface_

s4u::Storage simgrid::surf::StorageImpl::piface_

Public interface.

◆ content_

std::map<std::string, sg_size_t>* simgrid::surf::StorageImpl::content_

◆ size_

sg_size_t simgrid::surf::StorageImpl::size_

◆ usedSize_

sg_size_t simgrid::surf::StorageImpl::usedSize_

◆ typeId_

std::string simgrid::surf::StorageImpl::typeId_

◆ attach_

std::string simgrid::surf::StorageImpl::attach_

◆ storages

std::unordered_map< std::string, StorageImpl * > * simgrid::surf::StorageImpl::storages
static
Initial value:
=
new std::unordered_map<std::string, StorageImpl*>()

◆ writeActions_

std::vector<StorageAction*> simgrid::surf::StorageImpl::writeActions_

◆ constraintWrite_

lmm_constraint_t simgrid::surf::StorageImpl::constraintWrite_

◆ constraintRead_

lmm_constraint_t simgrid::surf::StorageImpl::constraintRead_

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