Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

VDirEvaluator.H

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 //
00020 // VDirEvaluator.H
00021 // Last modified on Wed Jan 11 16:10:42 EST 2006 by irina.furman@intel.com
00022 //      modified on Wed Jul 21 01:12:52 EDT 2004 by ken@xorian.net
00023 //      modified on Wed Aug  9 16:59:24 PDT 2000 by mann
00024 //
00025 // Directory of type evaluatorDirectory.  The contents of such a
00026 // directory are a binding held by the evalutor.  The methods of this
00027 // object type make remote calls to the evalutor.
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; // defined in VDirEvaluator.C
00038 
00039 // Below we describe the packed representation of a VDirEvaluatorRep.
00040 // See VDirChangeable.H for a description of the pseudo-C++ notation.
00041 //
00042 // packed struct VDirEvaluatorRep {
00043 //     Bit8 hasName: 1;               // bool, used by GC
00044 //     Bit8 visited: 1;               // bool, used by GC
00045 //     Bit8 spare: 2;
00046 //     Bit8 typecode: 4;              // Must be VMemPool::vDirEvaluator
00047 //     struct EvalDirInfo* edi        // All real content here
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     // Our versions of virtual methods from base class
00058     // There is no access checking on evaluator directories; the who
00059     //  arguments are all ignored.
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     // Construct a new VDirEvaluatorRep and a VDirEvaluator to
00073     // reference it.  Uses the current time if timestamp = 0.
00074     VDirEvaluator(VestaSource::typeTag type,
00075                   const char* hostname, const char* port,
00076                   Bit64 dirHandle, bool* alive, time_t timestamp =0) throw();
00077     // Construct a VDirEvaluator to point to an existing rep.
00078     VDirEvaluator(VestaSource::typeTag type, Bit8* rep) throw();
00079     VDirEvaluator(VestaSource::typeTag type, EvalDirInfo* edi) throw();
00080 
00081     // Garbage collection support
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     // Checkpointing.  VDirEvaluator objects have to be written to
00090     // the checkpoint so that we can continue after checkpointing by
00091     // reading the checkpoint back into memory.  They are not needed
00092     // for cold start recovery because they are considered volatile.
00093     Bit32 checkpoint(Bit32& nextSP, std::fstream& ckpt) throw();
00094 
00095     // Explicit free support
00096     void freeTree() throw();
00097 
00098     // Check whether the evaluator is alive
00099     bool alive();
00100 
00101     // Evaluator is known to be dead; purge cached connections
00102     void purge();
00103 
00104     time_t timestamp() throw();
00105 
00106     // Accessors for the packed representation
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

Generated on Mon May 8 00:48:49 2006 for Vesta by  doxygen 1.4.2