11 typedef StorageModel *StorageModelPtr;
14 typedef Storage *StoragePtr;
17 typedef StorageLmm *StorageLmmPtr;
20 typedef StorageAction *StorageActionPtr;
22 class StorageActionLmm;
23 typedef StorageActionLmm *StorageActionLmmPtr;
29 class StorageModel : public Model {
33 StoragePtr createResource(const char* id, const char* model, const char* type_id,
34 const char* content_name, const char* content_type, xbt_dict_t properties);
35 double shareResources(double now);
36 void updateActionsState(double now, double delta);
44 class Storage : virtual public Resource {
46 Storage(StorageModelPtr model, const char* name, xbt_dict_t properties);
49 void updateState(tmgr_trace_event_t event_type, double value, double date);
53 sg_storage_size_t m_size;
54 sg_storage_size_t m_usedSize;
57 virtual StorageActionPtr open(const char* mount, const char* path)=0;
58 virtual StorageActionPtr close(surf_file_t fd)=0;
59 //virtual StorageActionPtr unlink(surf_file_t fd)=0;
60 virtual StorageActionPtr ls(const char *path)=0;
61 virtual StorageActionPtr read(surf_file_t fd, sg_storage_size_t size)=0;
62 virtual StorageActionPtr write(surf_file_t fd, sg_storage_size_t size)=0;
63 virtual xbt_dict_t getContent()=0;
64 virtual sg_storage_size_t getSize()=0;
66 xbt_dict_t parseContent(char *filename);
68 xbt_dynar_t p_writeActions;
71 class StorageLmm : public ResourceLmm, public Storage {
73 StorageLmm(StorageModelPtr model, const char* name, xbt_dict_t properties,
74 lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
75 const char* type_id, char *content_name, char *content_type, size_t size);
77 StorageActionPtr open(const char* mount, const char* path);
78 StorageActionPtr close(surf_file_t fd);
79 //StorageActionPtr unlink(surf_file_t fd);
80 StorageActionPtr ls(const char *path);
81 xbt_dict_t getContent();
82 sg_storage_size_t getSize();
83 StorageActionPtr read(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ??
84 StorageActionPtr write(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ??
86 lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
87 lmm_constraint_t p_constraintRead; /* Constraint for maximum write bandwidth*/
95 READ=0, WRITE, STAT, OPEN, CLOSE, LS
96 } e_surf_action_storage_type_t;
99 class StorageAction : virtual public Action {
102 StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type)
103 : p_storage(storage), m_type(type) {};
107 e_surf_action_storage_type_t m_type;
108 StoragePtr p_storage;
113 class StorageActionLmm : public ActionLmm, public StorageAction {
115 StorageActionLmm(){};
116 StorageActionLmm(ModelPtr model, double cost, bool failed, StorageLmmPtr storage, e_surf_action_storage_type_t type);
120 //FIXME:??void recycle();
123 void setMaxDuration(double duration);
124 void setPriority(double priority);
129 typedef struct s_storage_type {
134 xbt_dict_t properties;
135 sg_storage_size_t size;
136 } s_storage_type_t, *storage_type_t;
138 typedef struct s_mount {
141 } s_mount_t, *mount_t;
143 typedef struct surf_file {
146 sg_storage_size_t size;
150 #endif /* STORAGE_HPP_ */