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 // Last modified on Wed Nov 27 12:58:26 EST 2002 by ken@xorian.net 00020 // modified on Tue Jun 6 17:46:17 2000 by schalk 00021 // modified on Thu Feb 10 11:31:37 PST 2000 by heydon 00022 00023 // CacheIntf -- defines constants for Cache Server interface, version, 00024 // procedures, and result codes 00025 00026 #ifndef _CACHE_INTF_H 00027 #define _CACHE_INTF_H 00028 00029 #include <Basics.H> 00030 00031 class CacheIntf { 00032 public: 00033 // Interface version (used by both clients and servers) 00034 // 00035 // History: 00036 // Version 1 - initial version 00037 // Version 2 - added Checkpoint() method; removed EraseCache() 00038 // Version 3 - added timestamps to Lookup() and AddEntry() 00039 // Version 4 - added RenewLeases() method and minimum derived 00040 // lease timestamp to the AddEntry() method 00041 // Version 5 - added support for weeding 00042 // Version 6 - changed format of free variable names on wire; 00043 // added "fvs" result to "Lookup" method 00044 // Version 7 - added GetLookupStats() method 00045 // Version 8 - removed timestamps 00046 // Version 9 - no longer uses int_seq to send CIs and DIs 00047 // Version 10 - removed "fvs" result from "Lookup" method 00048 // Version 11 - removed GetLookupStats() method 00049 // Version 12 - added "isEmpty" result to "FreeVariables" method 00050 // Version 13 - added "pkgVersion" argument to "Checkpoint" method 00051 // Version 14 - added "GetCacheId" and "GetCacheState" methods 00052 // Version 15 - changed size of PKPrefix::T 00053 // Version 16 - changed "FreeVars" signature to use CompactFV::List 00054 // Version 17 - removed derived timestamp arg to "AddEntry" method 00055 // Version 18 - added boolean return result to "WeederRecovering" 00056 // Version 19 - added Text "sourceFunc" argument to "AddEntry" 00057 // Version 20 - added GetCacheInstance() method; changed several 00058 // methods to include the instance fingerprint to avoid 00059 // evaluations and weeds continuing across cache server 00060 // restarts. 00061 // Version 21 - Changed CommitChkpt() to accept its checkpoint 00062 // relative to the graph log root. A couple 00063 // potentially problematic things are cleaned up 00064 // with that method. 00065 // Version 22 - Eliminated inappropriate uses of 00066 // send_bytes/recv_bytes for integers and arrays of 00067 // integers. This makes it possible for cache 00068 // servers and clients of different byte orders to 00069 // inter-operate. 00070 00071 enum { Version = 22 }; 00072 00073 // Debugging levels 00074 enum DebugLevel { 00075 None = 0, // no debugging at all 00076 StatusMsgs, // cache/weeder status messages 00077 LeaseExp, // lease expiration messages 00078 LogRecover, // show recovered data at start-up 00079 LogFlush, // show when logs are flushed 00080 MPKFileFlush, // show when MPKFiles are flushed 00081 LogFlushEntries, // also show individual entries written to logs 00082 WeederOps, // show operations related to the weeder 00083 AddEntryOp, // show SRPC calls for "AddEntry" 00084 OtherOps, // show all other SRPC calls 00085 WeederScans, // show scans of graphLog by weeder 00086 All // all levels 00087 }; 00088 static char *DebugName(int i) throw (); 00089 /* Return a string name for debugging level "i". */ 00090 00091 // Procedure identifiers 00092 enum ProcIds { 00093 // evaluator client procs 00094 AddEntryProc, FreeVarsProc, LookupProc, 00095 CheckpointProc, RenewLeasesProc, 00096 00097 // weeder client procs 00098 WeedRecoverProc, StartMarkProc, SetHitFilterProc, 00099 GetLeasesProc, ResumeLeasesProc, EndMarkProc, CommitChkptProc, 00100 00101 // procs used by both the evaluator and weeder 00102 GetCacheInstanceProc, 00103 00104 // debugging client procs 00105 FlushAllProc, GetCacheIdProc, GetCacheStateProc 00106 }; 00107 00108 // "Lookup" result codes and names 00109 enum LookupRes { Hit, Miss, FVMismatch, BadLookupArgs }; 00110 static const char *const LookupResName(LookupRes res) throw (); 00111 00112 // the kinds of lookup outcomes 00113 enum LookupOutcome { 00114 NewHits, WarmHits, DiskHits, AllMisses, NumKinds, NoOutcome}; 00115 00116 // "AddEntry" result codes and names 00117 enum AddEntryRes { EntryAdded, NoLease, BadAddEntryArgs }; 00118 static const char *const AddEntryResName(AddEntryRes res) throw (); 00119 }; 00120 00121 #endif // _CACHE_INTF_H