Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better leaking than segfaulting
[simgrid.git] / src / surf / storage_n11.hpp
1 /* Copyright (c) 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <xbt/base.h>
8
9 #include "storage_interface.hpp"
10
11 #ifndef STORAGE_N11_HPP_
12 #define STORAGE_N11_HPP_
13
14 namespace simgrid {
15 namespace surf {
16
17 /***********
18  * Classes *
19  ***********/
20
21 class XBT_PRIVATE StorageN11Model;
22 class XBT_PRIVATE StorageN11;
23 class XBT_PRIVATE StorageN11Action;
24
25 /*********
26  * Model *
27  *********/
28
29 class StorageN11Model : public StorageModel {
30 public:
31   StorageN11Model();
32   ~StorageN11Model();
33   Storage *createStorage(const char* id, const char* type_id,
34                    const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach);
35   void addTraces(){DIE_IMPOSSIBLE;}
36   double shareResources(double now);
37   void updateActionsState(double now, double delta);
38 };
39
40 /************
41  * Resource *
42  ************/
43
44 class StorageN11 : public Storage {
45 public:
46   StorageN11(StorageModel *model, const char* name, xbt_dict_t properties,
47                      lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
48                      const char* type_id, char *content_name, char *content_type, sg_size_t size, char *attach);
49
50   StorageAction *open(const char* mount, const char* path);
51   StorageAction *close(surf_file_t fd);
52   StorageAction *ls(const char *path);
53   StorageAction *read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param  *??
54   StorageAction *write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param  *??
55   void rename(const char *src, const char *dest);
56
57   lmm_constraint_t p_constraintWrite;    /* Constraint for maximum write bandwidth*/
58   lmm_constraint_t p_constraintRead;     /* Constraint for maximum write bandwidth*/
59 };
60
61 /**********
62  * Action *
63  **********/
64
65 class StorageN11Action : public StorageAction {
66 public:
67   StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type);
68   void suspend();
69   int unref();
70   void cancel();
71   void resume();
72   bool isSuspended();
73   void setMaxDuration(double duration);
74   void setPriority(double priority);
75
76 };
77
78 }
79 }
80
81 #endif /* STORAGE_N11_HPP_ */