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 StorageLmm *StorageLmmPtr;
22 typedef StorageAction *StorageActionPtr;
24 class StorageActionLmm;
25 typedef StorageActionLmm *StorageActionLmmPtr;
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 : virtual public Resource {
46 Storage(const char* type_id, char *content_name, char *content_type, sg_size_t size);
50 void updateState(tmgr_trace_event_t event_type, double value, double date);
58 virtual StorageActionPtr open(const char* mount, const char* path)=0;
59 virtual StorageActionPtr close(surf_file_t fd)=0;
60 //virtual StorageActionPtr unlink(surf_file_t fd)=0;
61 virtual StorageActionPtr ls(const char *path)=0;
62 virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
63 virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
64 virtual void rename(const char *src, const char *dest)=0;
66 virtual xbt_dict_t getContent();
67 virtual sg_size_t getSize();
69 xbt_dict_t parseContent(char *filename);
71 xbt_dynar_t p_writeActions;
74 class StorageLmm : public ResourceLmm, public Storage {
76 StorageLmm(lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
77 const char* type_id, char *content_name, char *content_type, sg_size_t size);
79 lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
80 lmm_constraint_t p_constraintRead; /* Constraint for maximum write bandwidth*/
88 READ=0, WRITE, STAT, OPEN, CLOSE, LS
89 } e_surf_action_storage_type_t;
92 class StorageAction : virtual public Action {
94 StorageAction() : m_type(READ) {};//FIXME:REMOVE
95 StorageAction(StoragePtr storage, e_surf_action_storage_type_t type);
97 e_surf_action_storage_type_t m_type;
103 class StorageActionLmm : public ActionLmm, public StorageAction {
105 StorageActionLmm() {};//FIXME:REMOVE
107 StorageActionLmm(StorageLmmPtr storage, e_surf_action_storage_type_t type);
110 typedef struct s_storage_type {
115 xbt_dict_t properties;
117 } s_storage_type_t, *storage_type_t;
119 typedef struct s_mount {
122 } s_mount_t, *mount_t;
124 typedef struct surf_file {
128 sg_size_t current_position;
132 #endif /* STORAGE_INTERFACE_HPP_ */