00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _VDIREV
00031 #define _VDIREV 1
00032
00033 #include "VestaSource.H"
00034 #include "MultiSRPC.H"
00035 #include "VMemPool.H"
00036
00037 struct EvalDirInfo;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define VDIREV_FLAGS 0
00051 #define VDIREV_EDI 1
00052 #define VDIREV_SIZE (VDIREV_EDI+sizeof(EvalDirInfo*))
00053
00054 class VDirEvaluator : public VestaSource {
00055 EvalDirInfo* edi;
00056 public:
00057
00058
00059
00060 VestaSource::errorCode lookup(Arc arc, VestaSource*& result,
00061 AccessControl::Identity who =NULL,
00062 unsigned int indexOffset =0) throw();
00063 VestaSource::errorCode
00064 lookupIndex(unsigned int index, VestaSource*& result,
00065 char* arcbuf =NULL) throw();
00066 VestaSource::errorCode
00067 list(unsigned int firstIndex,
00068 VestaSource::listCallback callback, void* closure,
00069 AccessControl::Identity who =NULL, bool deltaOnly =false,
00070 unsigned int indexOffset =0) throw();
00071
00072
00073
00074 VDirEvaluator(VestaSource::typeTag type,
00075 const char* hostname, const char* port,
00076 Bit64 dirHandle, bool* alive, time_t timestamp =0) throw();
00077
00078 VDirEvaluator(VestaSource::typeTag type, Bit8* rep) throw();
00079 VDirEvaluator(VestaSource::typeTag type, EvalDirInfo* edi) throw();
00080
00081
00082 void mark(bool byName =true, ArcTable* hidden =NULL) throw();
00083 static void markCallback(void* closure, VMemPool::typeCode type) throw();
00084 static bool sweepCallback(void* closure, VMemPool::typeCode type,
00085 void* addr, Bit32& size) throw();
00086 static void rebuildCallback(void* closure, VMemPool::typeCode type,
00087 void* addr, Bit32& size) throw();
00088
00089
00090
00091
00092
00093 Bit32 checkpoint(Bit32& nextSP, std::fstream& ckpt) throw();
00094
00095
00096 void freeTree() throw();
00097
00098
00099 bool alive();
00100
00101
00102 void purge();
00103
00104 time_t timestamp() throw();
00105
00106
00107 public:
00108 inline bool hasName() throw()
00109 { return (bool) ((rep[VDIREV_FLAGS] & 1) != 0); };
00110 inline void setHasName(bool newval) throw()
00111 { rep[VDIREV_FLAGS] = (rep[VDIREV_FLAGS] & 0xfe) | (int)newval; };
00112 inline bool visited() throw()
00113 { return (bool) ((rep[VDIREV_FLAGS] & 2) != 0); };
00114 inline void setVisited(bool newval) throw()
00115 { rep[VDIREV_FLAGS] = (rep[VDIREV_FLAGS] & 0xfd) | ((int)newval << 1); };
00116 private:
00117 inline EvalDirInfo* repEDI() throw()
00118 { EvalDirInfo* ret;
00119 memcpy(&ret, &rep[VDIREV_EDI], sizeof(EvalDirInfo*)); return ret; };
00120 inline void setRepEDI(EvalDirInfo* repEDI) throw()
00121 { memcpy(&rep[VDIREV_EDI], &repEDI, sizeof(EvalDirInfo*)); };
00122 };
00123
00124 #endif //_VDIREV