00001
00002
00003
00004 #ifndef DMLITE_CPP_POOLMANAGER_H
00005 #define DMLITE_CPP_POOLMANAGER_H
00006
00007 #include "dmlite/common/config.h"
00008 #include "base.h"
00009 #include "exceptions.h"
00010 #include "pooldriver.h"
00011 #include "utils/extensible.h"
00012 #include "dmlite/c/pool.h"
00013 #include <string>
00014 #include <vector>
00015
00016 namespace dmlite {
00017
00018
00019 class StackInstance;
00020
00021
00022 struct Pool: public Extensible {
00023 std::string name;
00024 std::string type;
00025
00026 bool operator == (const Pool&) const;
00027 bool operator != (const Pool&) const;
00028 bool operator < (const Pool&) const;
00029 bool operator > (const Pool&) const;
00030 };
00031
00032
00033
00034 typedef struct xferprogmarker {
00035 int64_t xferred;
00036
00037 } xferprogmarker;
00038
00039
00040 class PoolManager: public virtual BaseInterface {
00041 public:
00042 enum PoolAvailability { kAny, kNone, kForRead, kForWrite, kForBoth};
00043
00044
00045 virtual ~PoolManager();
00046
00047
00048
00049 virtual std::vector<Pool> getPools(PoolAvailability availability = kAny) ;
00050
00051
00052 virtual Pool getPool(const std::string& poolname) ;
00053
00054
00055 virtual void newPool(const Pool& pool) ;
00056
00057
00058 virtual void updatePool(const Pool& pool) ;
00059
00060
00061 virtual void deletePool(const Pool& pool) ;
00062
00063
00064
00065 virtual Location whereToRead(const std::string& path) ;
00066
00067
00068
00069 virtual Location whereToRead(ino_t inode) ;
00070
00071
00072
00073
00074 virtual Location whereToWrite(const std::string& path) ;
00075
00076
00077
00078
00079 virtual Location chooseServer(const std::string& path) ;
00080
00081
00082
00083
00084 virtual void cancelWrite(const Location& loc) ;
00085
00086
00087
00088
00089
00090 virtual void getDirSpaces(const std::string& path, int64_t &totalfree, int64_t &used) ;
00091
00092
00093
00094
00095
00096
00097 virtual DmStatus fileCopyPush(const std::string& localsrcpath, const std::string &remotedesturl, int cksumcheck, char *cksumtype, dmlite_xferinfo *progressdata) ;
00098
00099
00100
00101
00102
00103
00104 virtual DmStatus fileCopyPull(const std::string& localdestpath, const std::string &remotesrcurl, int cksumcheck, char *cksumtype, dmlite_xferinfo *progressdata) ;
00105 };
00106
00107
00108 class PoolManagerFactory: public virtual BaseFactory {
00109 public:
00110
00111 virtual ~PoolManagerFactory();
00112
00113 protected:
00114
00115 friend class StackInstance;
00116
00117
00118 static PoolManager* createPoolManager(PoolManagerFactory* factory,
00119 PluginManager* pm) ;
00120
00121
00122 virtual PoolManager* createPoolManager(PluginManager* pm) ;
00123 };
00124
00125 };
00126
00127 #endif // DMLITE_CPP_POOLMANAGER_H