00001
00002
00003
00004 #ifndef DMLITE_CPP_CATALOG_H
00005 #define DMLITE_CPP_CATALOG_H
00006
00007 #include "../common/config.h"
00008 #include "base.h"
00009 #include "exceptions.h"
00010 #include "inode.h"
00011 #include "utils/extensible.h"
00012
00013 #include <dirent.h>
00014 #include <sys/stat.h>
00015 #include <string>
00016 #include <vector>
00017 #include <utime.h>
00018
00019 namespace dmlite {
00020
00021
00022 class StackInstance;
00023 class PluginManager;
00024
00025
00026 struct Directory { virtual ~Directory(); };
00027
00028
00029 class Catalog: public virtual BaseInterface {
00030 public:
00031
00032 virtual ~Catalog();
00033
00034
00035
00036 virtual void changeDir(const std::string& path) throw (DmException);
00037
00038
00039
00040 virtual std::string getWorkingDir(void) throw (DmException);
00041
00042
00043
00044
00045
00046 virtual ExtendedStat extendedStat(const std::string& path,
00047 bool followSym = true) throw (DmException);
00048
00049
00050
00051
00052 virtual ExtendedStat extendedStatByRFN(const std::string& rfn) throw (DmException);
00053
00054
00055
00056
00057
00058
00059 virtual bool access(const std::string& path, int mode) throw (DmException);
00060
00061
00062
00063
00064
00065
00066 virtual bool accessReplica(const std::string& replica, int mode) throw (DmException);
00067
00068
00069
00070
00071 virtual void addReplica(const Replica& replica) throw (DmException);
00072
00073
00074
00075 virtual void deleteReplica(const Replica& replica) throw (DmException);
00076
00077
00078
00079 virtual std::vector<Replica> getReplicas(const std::string& path) throw (DmException);
00080
00081
00082
00083
00084 virtual void symlink(const std::string& path,
00085 const std::string& symlink) throw (DmException);
00086
00087
00088
00089
00090 virtual std::string readLink(const std::string& path) throw (DmException);
00091
00092
00093
00094 virtual void unlink(const std::string& path) throw (DmException);
00095
00096
00097
00098
00099 virtual void create(const std::string& path,
00100 mode_t mode) throw (DmException);
00101
00102
00103
00104
00105 virtual mode_t umask(mode_t mask) throw ();
00106
00107
00108
00109
00110 virtual void setMode(const std::string& path,
00111 mode_t mode) throw (DmException);
00112
00113
00114
00115
00116
00117
00118 virtual void setOwner(const std::string& path, uid_t newUid, gid_t newGid,
00119 bool followSymLink = true) throw (DmException);
00120
00121
00122
00123
00124 virtual void setSize(const std::string& path,
00125 size_t newSize) throw (DmException);
00126
00127
00128
00129
00130
00131 virtual void setChecksum(const std::string& path,
00132 const std::string& csumtype,
00133 const std::string& csumvalue) throw (DmException);
00134
00135
00136
00137
00138 virtual void setAcl(const std::string& path,
00139 const Acl& acl) throw (DmException);
00140
00141
00142
00143
00144 virtual void utime(const std::string& path,
00145 const struct utimbuf* buf) throw (DmException);
00146
00147
00148
00149
00150 virtual std::string getComment(const std::string& path) throw (DmException);
00151
00152
00153
00154
00155 virtual void setComment(const std::string& path,
00156 const std::string& comment) throw (DmException);
00157
00158
00159
00160
00161 virtual void setGuid(const std::string& path,
00162 const std::string &guid) throw (DmException);
00163
00164
00165
00166
00167 virtual void updateExtendedAttributes(const std::string& path,
00168 const Extensible& attr) throw (DmException);
00169
00170
00171
00172
00173 virtual Directory* openDir(const std::string& path) throw (DmException);
00174
00175
00176
00177 virtual void closeDir(Directory* dir) throw (DmException);
00178
00179
00180
00181
00182 virtual struct dirent* readDir(Directory* dir) throw (DmException);
00183
00184
00185
00186
00187 virtual ExtendedStat* readDirx(Directory* dir) throw (DmException);
00188
00189
00190
00191
00192 virtual void makeDir(const std::string& path,
00193 mode_t mode) throw (DmException);
00194
00195
00196
00197
00198 virtual void rename(const std::string& oldPath,
00199 const std::string& newPath) throw (DmException);
00200
00201
00202
00203 virtual void removeDir(const std::string& path) throw (DmException);
00204
00205
00206
00207 virtual Replica getReplicaByRFN(const std::string& rfn) throw (DmException);
00208
00209
00210
00211
00212 virtual void updateReplica(const Replica& replica) throw (DmException);
00213 };
00214
00215
00216 class CatalogFactory: public virtual BaseFactory {
00217 public:
00218
00219 virtual ~CatalogFactory();
00220
00221 protected:
00222
00223 friend class StackInstance;
00224
00225
00226 static Catalog* createCatalog(CatalogFactory* factory,
00227 PluginManager* pm) throw (DmException);
00228
00229
00230 virtual Catalog* createCatalog(PluginManager* pm) throw (DmException);
00231 };
00232
00233 };
00234
00235 #endif // DMLITE_CPP_CATALOG_H