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