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, const char* content_name);
34 double shareResources(double now);
35 void updateActionsState(double now, double delta);
43 class Storage : virtual public Resource {
45 Storage(StorageModelPtr model, const char* name, xbt_dict_t properties);
48 void updateState(tmgr_trace_event_t event_type, double value, double date);
50 xbt_dict_t p_content; /* char * -> s_surf_file_t */
52 virtual StorageActionPtr open(const char* mount, const char* path)=0;
53 virtual StorageActionPtr close(surf_file_t fd)=0;
54 //virtual StorageActionPtr unlink(surf_file_t fd)=0;
55 virtual StorageActionPtr ls(const char *path)=0;
56 //virtual size_t getSize(surf_file_t fd);
57 virtual StorageActionPtr read(void* ptr, size_t size, surf_file_t fd)=0;//FIXME:why we have a useless param ptr ??
58 virtual StorageActionPtr write(const void* ptr, size_t size, surf_file_t fd)=0;//FIXME:why we have a useless param ptr ??
59 xbt_dict_t parseContent(char *filename);
63 xbt_dynar_t p_writeActions;
66 class StorageLmm : public ResourceLmm, public Storage {
68 StorageLmm(StorageModelPtr model, const char* name, xbt_dict_t properties,
69 lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
70 char *content_name, size_t size);
72 StorageActionPtr open(const char* mount, const char* path);
73 StorageActionPtr close(surf_file_t fd);
74 //StorageActionPtr unlink(surf_file_t fd);
75 StorageActionPtr ls(const char *path);
76 //size_t getSize(surf_file_t fd);
77 StorageActionPtr read(void* ptr, size_t size, surf_file_t fd);//FIXME:why we have a useless param ptr ??
78 StorageActionPtr write(const void* ptr, size_t size, surf_file_t fd);//FIXME:why we have a useless param ptr ??
80 lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
81 lmm_constraint_t p_constraintRead; /* Constraint for maximum write bandwidth*/
89 READ=0, WRITE, STAT, OPEN, CLOSE, LS
90 } e_surf_action_storage_type_t;
93 class StorageAction : virtual public Action {
96 StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type)
97 : p_storage(storage), m_type(type) {};
101 e_surf_action_storage_type_t m_type;
102 StoragePtr p_storage;
107 class StorageActionLmm : public ActionLmm, public StorageAction {
109 StorageActionLmm(){};
110 StorageActionLmm(ModelPtr model, double cost, bool failed, StorageLmmPtr storage, e_surf_action_storage_type_t type);
114 //FIXME:??void recycle();
117 void setMaxDuration(double duration);
118 void setPriority(double priority);
123 typedef struct s_storage_type {
127 xbt_dict_t properties;
129 } s_storage_type_t, *storage_type_t;
131 typedef struct s_mount {
134 } s_mount_t, *mount_t;
136 typedef struct surf_file {
143 #endif /* STORAGE_HPP_ */