![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /BdbAdminTools/BdbShowClustSettings.cc
Go to the documentation of this file.00001 //------------------------------------------------------------------------------ 00002 // File and Version Information: 00003 // BdbShowClustSettings.cc 00004 // 00005 // Description: 00006 // Program which prints clustering hint setting per component. 00007 // 00008 // Environment: 00009 // Software developed for the BaBar Detector at the SLAC B-Factory. 00010 // 00011 // Author List: 00012 // Jacek Becla Original author 00013 // 00014 // Copyright Information: 00015 // Copyright (C) 2000 Stanford Linear Accelerator Center 00016 // 00017 //------------------------------------------------------------------------------ 00018 00019 00020 00021 #include <iostream.h> 00022 #include <string.h> 00023 #include <stdlib.h> 00024 00025 #include "BdbApplication/BdbDomain.hh" 00026 #include "BdbAccess/BdbDomainSpec.hh" 00027 #include "BdbAccess/BdbClustHintSetupMgr.hh" 00028 #include "BdbAccess/BdbTFileSystem.hh" 00029 #include "BdbEventStore/BdbEventStore.hh" 00030 #include "BdbClustering/BdbEvsClusteringHint.hh" 00031 00032 00033 extern "C" { 00034 #include <ctype.h> /* tolower */ 00035 } 00036 00037 00038 00039 char domainName[64], authLevelName[64], authName[64], compName[64]; 00040 00041 00042 00043 const char* getDomain() 00044 { 00045 int i, nr; 00046 BdbDomain::Domains dd; 00047 00048 for (i=0,dd=BdbDomain::FirstDomain ; 00049 dd<BdbDomain::IllegalDomain ; 00050 dd=(BdbDomain::Domains) ((int)dd+1), i++) { 00051 const char* n = BdbDomain::DomainNames[dd]; 00052 cout << i+1 << ") " << n << endl; 00053 } 00054 00055 do { 00056 char c; 00057 cout << "Press 1-" << i << " "; cin >> c; 00058 nr = c - '0'; 00059 } while (nr<0 || nr>i); 00060 00061 return BdbDomain::ShortDomainNames[nr-1]; 00062 } 00063 00064 00065 00066 00067 void oldVersion() 00068 { 00069 BdbEventStore* theStore = BdbEventStore::instance(); 00070 BdbEventStore::instance()->configureClustering( ); 00071 if ( tolower(authLevelName[0]) == 's' ) { 00072 theStore->setAuthLevel(BdbDomain::System); 00073 } else if ( tolower(authLevelName[0]) == 'g' ) { 00074 theStore->setAuthLevel(BdbDomain::Group, authName); 00075 } else { 00076 theStore->setAuthLevel(BdbDomain::User); 00077 } 00078 00079 BdbEvsClusteringHint clH(*theStore, compName); 00080 clH.printSetting(); 00081 } 00082 00083 00084 void newVersion() 00085 { 00086 cout << "disabled" << endl; 00087 /* 00088 BdbClustHintSetupMgr* chsMgr = BdbClustHintSetupMgr::instance(); 00089 chsMgr->initCHSetupObj(); 00090 chsMgr->setStrings(domainName, authLevelName, authName, compName); 00091 d_ULong values[10]; 00092 00093 chsMgr->retrieveDomainSpec((unsigned*)values, 10); 00094 cout << " values for : " << domainName << " " << authLevelName << " " 00095 << authName << " " << compName << "\n" 00096 << " dirRange = " << values[0] << "\n" 00097 << " initNrPages = " << values[1] << "\n" 00098 << " percGrowth = " << values[2] << "\n" 00099 << " contHashing = " << values[3] << "\n" 00100 << " minNoPrecrDbs = " << values[4] << "\n" 00101 << " maxNoPrecrDbs = " << values[5] << "\n" 00102 << " precrNoConts = " << values[6] << "\n" 00103 << " maxDbSize = " << values[7] << "\n" 00104 << " prefContSize = " << values[8] << "\n" 00105 << " hardContLimit = " << values[9] << endl; 00106 00107 const char* groupName = chsMgr->retrieveFSGroupName(); 00108 cout << " Group name = " << groupName << endl; 00109 00110 00111 d_ULong noFS = chsMgr->noFileSystemsInGroup(groupName); 00112 cout << " noFS = " << noFS << endl; 00113 00114 int i; 00115 for ( i=0; i<noFS ; i++ ) { 00116 BdbTFileSystem tSys; 00117 if ( ! chsMgr->locateTFileSystem(tSys, i, groupName) ) { 00118 cerr << "Error while locating fs, groupName=" << groupName 00119 << ", position=" << i << endl; 00120 return; 00121 } 00122 tSys.displayData(); 00123 } 00124 */ 00125 } 00126 00127 00128 00129 int main(int argc, char *argv[]) 00130 { 00131 // Start a domain (any domain) 00132 BdbEventStore::instance()->activate() ; 00133 00134 BdbDomainSpec::_version = 2; 00135 00136 if ( argc == 5 ) { 00137 strcpy(domainName, argv[1]); 00138 strcpy(authLevelName, argv[2]); 00139 strcpy(authName, argv[3]); 00140 strcpy(compName, argv[4]); 00141 } else { 00142 strcpy(domainName, getDomain()); 00143 //strcpy(authLevelName, getAuthLevelName()); 00144 //strcpy(authLevelName, getAuthName()); 00145 //strcpy(authLevelName, getCompName()); 00146 } 00147 00148 00149 00150 00151 //cout << "Setting for " << domainName << "-" << authLevelName << "-" 00152 // << authName << "-" << compName << endl; 00153 00154 00155 BdbApplicationOrDomain* app = BdbApplicationOrDomain::activeInstance(); 00156 00157 if ( ! strcmp(domainName, "events" ) ) { 00158 00159 app->startRead("getConf"); 00160 newVersion(); 00161 app->commit("getConf"); 00162 } else { 00163 cout << "Not implemented for this domain" << endl; 00164 return -1; 00165 } 00166 00167 return 0; 00168 }
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002