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

CacheConfig.C

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 // Last modified on Thu Nov  8 12:36:38 EST 2001 by ken@xorian.net
00020 //      modified on Tue Feb  1 14:29:57 PST 2000 by heydon
00021 
00022 #include <Basics.H>
00023 #include "ReadConfig.H"
00024 #include "CacheConfig.H"
00025 
00026 // Section names in Vesta configuration file
00027 const char *Config_CacheSection = "CacheServer";
00028 
00029 // Values from Vesta configuration file
00030 const Text Config_Host(
00031   ReadConfig::TextVal(Config_CacheSection, "Host"));
00032 const Text Config_Port(
00033   ReadConfig::TextVal(Config_CacheSection, "Port"));
00034 static const Text Private_Dot(".");
00035 static const Text Private_MDRoot(
00036   ReadConfig::TextVal(Config_CacheSection, "MetaDataRoot"));
00037 const Text Config_MDRoot(
00038   Private_MDRoot.Empty() ? Private_Dot : Private_MDRoot);
00039 const Text Config_MDDir(
00040   ReadConfig::TextVal(Config_CacheSection, "MetaDataDir"));
00041 const Text Config_SVarsDir(
00042   ReadConfig::TextVal(Config_CacheSection, "StableVarsDir"));
00043 const Text Config_Deleting(
00044   ReadConfig::TextVal(Config_CacheSection, "Deleting"));
00045 const Text Config_HitFilter(
00046   ReadConfig::TextVal(Config_CacheSection, "HitFilter"));
00047 const Text Config_MPKsToWeed(
00048   ReadConfig::TextVal(Config_CacheSection, "MPKsToWeed"));
00049 const Text Config_SCacheDir(
00050   ReadConfig::TextVal(Config_CacheSection, "SCacheDir"));
00051 const Text Config_WeededLogDir(
00052   ReadConfig::TextVal(Config_CacheSection, "WeededLogDir"));
00053 const Text Config_CacheLogDir(
00054   ReadConfig::TextVal(Config_CacheSection, "CacheLogDir"));
00055 const Text Config_EmptyPKLogDir(
00056   ReadConfig::TextVal(Config_CacheSection, "EmptyPKLogDir"));
00057 const Text Config_GraphLogDir(
00058   ReadConfig::TextVal(Config_CacheSection, "GraphLogDir"));
00059 const Text Config_CILogDir(
00060   ReadConfig::TextVal(Config_CacheSection, "CILogDir"));
00061 const int  Config_LeaseTimeoutHrs =
00062   ReadConfig::IntVal(Config_CacheSection, "LeaseTimeoutHrs");
00063 
00064 // optional values
00065 int Config_LeaseTimeoutSpeedup(1);
00066 
00067 // Values formed from configuration values
00068 const Text Config_CacheMDPath(Config_MDRoot +'/'+ Config_MDDir);
00069 const Text Config_SVarsPath(Config_CacheMDPath +'/'+ Config_SVarsDir);
00070 const Text Config_DeletingFile(Config_SVarsPath +'/'+ Config_Deleting);
00071 const Text Config_HitFilterFile(Config_SVarsPath +'/'+ Config_HitFilter);
00072 const Text Config_MPKsToWeedFile(Config_SVarsPath +'/'+ Config_MPKsToWeed);
00073 const Text Config_SCachePath(Config_CacheMDPath +'/'+ Config_SCacheDir);
00074 const Text Config_WeededLogPath(Config_CacheMDPath +'/'+ Config_WeededLogDir);
00075 const Text Config_CacheLogPath(Config_CacheMDPath +'/'+ Config_CacheLogDir);
00076 const Text Config_EmptyPKLogPath(Config_CacheMDPath +'/'+Config_EmptyPKLogDir);
00077 const Text Config_GraphLogPath(Config_CacheMDPath +'/'+ Config_GraphLogDir);
00078 const Text Config_CILogPath(Config_CacheMDPath +'/'+ Config_CILogDir);
00079 int Config_LeaseTimeoutSecs;
00080 
00081 class CacheConfigInit {
00082   public:
00083     CacheConfigInit() throw ();
00084     // initialize the "CacheConfig" module
00085 };
00086 static CacheConfigInit cacheConfigInit;
00087 
00088 CacheConfigInit::CacheConfigInit() throw ()
00089 {
00090     (void) ReadConfig::OptIntVal(Config_CacheSection,
00091       "LeaseTimeoutSpeedup", /*OUT*/ Config_LeaseTimeoutSpeedup);
00092     const int SecsPerHour = 3600;
00093     Config_LeaseTimeoutSecs = max(1,
00094       (Config_LeaseTimeoutHrs * SecsPerHour) / Config_LeaseTimeoutSpeedup);
00095 }
00096 

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