1 #include "surf_interface.hpp"
3 #ifndef STORAGE_INTERFACE_HPP_
4 #define STORAGE_INTERFACE_HPP_
6 extern xbt_dynar_t mount_list;
13 typedef StorageModel *StorageModelPtr;
16 typedef Storage *StoragePtr;
19 typedef Storage *StoragePtr;
22 typedef StorageAction *StorageActionPtr;
25 typedef StorageAction *StorageActionPtr;
30 class StorageModel : public Model {
34 virtual StoragePtr createResource(const char* id, const char* type_id,
35 const char* content_name, const char* content_type, xbt_dict_t properties)=0;
37 xbt_dynar_t p_storageList;
44 class Storage : public Resource {
46 Storage(ModelPtr model, const char *name, xbt_dict_t props,
47 const char* type_id, char *content_name, char *content_type, sg_size_t size);
48 Storage(ModelPtr model, const char *name, xbt_dict_t props,
49 lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
50 const char* type_id, char *content_name, char *content_type, sg_size_t size);
54 void updateState(tmgr_trace_event_t event_type, double value, double date);
62 virtual StorageActionPtr open(const char* mount, const char* path)=0;
63 virtual StorageActionPtr close(surf_file_t fd)=0;
64 //virtual StorageActionPtr unlink(surf_file_t fd)=0;
65 virtual StorageActionPtr ls(const char *path)=0;
66 virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
67 virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
68 virtual void rename(const char *src, const char *dest)=0;
70 virtual xbt_dict_t getContent();
71 virtual sg_size_t getSize();
73 xbt_dict_t parseContent(char *filename);
75 xbt_dynar_t p_writeActions;
77 lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
78 lmm_constraint_t p_constraintRead; /* Constraint for maximum write bandwidth*/
86 READ=0, WRITE, STAT, OPEN, CLOSE, LS
87 } e_surf_action_storage_type_t;
90 class StorageAction : public Action {
92 StorageAction() : m_type(READ) {};//FIXME:REMOVE
93 StorageAction(ModelPtr model, double cost, bool failed,
94 StoragePtr storage, e_surf_action_storage_type_t type);
95 StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
96 StoragePtr storage, e_surf_action_storage_type_t type);
98 e_surf_action_storage_type_t m_type;
104 typedef struct s_storage_type {
109 xbt_dict_t properties;
111 } s_storage_type_t, *storage_type_t;
113 typedef struct s_mount {
116 } s_mount_t, *mount_t;
118 typedef struct surf_file {
122 sg_size_t current_position;
126 #endif /* STORAGE_INTERFACE_HPP_ */