11 std::string fname =
"file:test.xml";
12 if ( argc>1 ) fname = argv[1];
13 if ( argc>2 ) nwrite = ::atol(argv[2]);
16 std::vector<std::string> fids;
18 time_t
start = time(0);
19 for(
size_t n=fids.size(),
i=
n;
i<
n+nwrite; ++
i) {
20 std::ostringstream txt;
21 if ( 0 == ((
i-
n)%10000) ) std::cout <<
i-
n << std::endl;
24 txt <<
"PFN1_Test_" <<
i <<
".dat";
28 txt <<
"PFN2_Test_" << i <<
".dat";
31 txt <<
"PFN3_Test_" << i <<
".dat";
34 txt <<
"lfn1_Test_" << i <<
".dat";
37 txt <<
"lfn2_Test_" << i <<
".dat";
40 txt <<
"lfn3_Test_" << i <<
".dat";
48 std::cout <<
"Used " << end <<
" seconds."
49 <<
" corresponding to " << float(end)/float(nwrite) <<
" entries/second."
53 time_t saved = time(0)-(start+
end);
54 std::cout <<
"Used " << saved <<
" seconds."
55 <<
" corresponding to " << float(saved)/float(nwrite) <<
" entries/second."
59 std::cout <<
"Error: Catalog is not dirty after inserting records." << std::endl;
66 std::vector<std::string> fids;
67 std::string fname =
"file:test.xml";
68 if ( argc>1 ) fname = argv[1];
70 time_t
start = time(0);
73 std::cout <<
"File loaded in " << time(0)-start <<
" seconds. " << std::endl;
76 std::cout <<
"FIDs scanned in " << time(0)-start <<
" seconds. " << std::endl;
78 size_t mult = prt ? 1 : 10;
79 std::cout << mult*fids.size() << std::endl;
80 for(
size_t i=0, tot=(mult*fids.size());
i<tot; ++
i) {
81 size_t ent =
i%fids.size();
82 if ( ent == 0 ) std::cout <<
i << std::endl;
83 std::string fid = fids[ent];
84 XMLFileCatalog::Files pfn, lfn;
85 XMLFileCatalog::Attributes attrs;
87 for(
size_t l1=0; l1<lfn.size(); ++l1) {
89 std::cout <<
"Error LFN existence of :" << lfn[l1].second << std::endl;
92 std::string f = c.
lookupLFN(lfn[l1].first);
94 std::cout <<
"Error LFN lookup of :" << lfn[l1].second << std::endl;
99 for(
size_t l2=0; l2<pfn.size(); ++l2) {
101 std::cout <<
"Error PFN existence of :" << pfn[l2].second << std::endl;
104 std::string f = c.
lookupPFN(pfn[l2].first);
106 std::cout <<
"Error PFN lookup of :" << pfn[l2].second << std::endl;
111 size_t n = lfn.size() > pfn.size() ? lfn.size() : pfn.size();
112 n = n > attrs.size() ? n : attrs.size();
114 std::cout <<
"FID:" << fid << std::endl;
115 for(
size_t j=0; j<
n; ++j) {
116 if ( j < lfn.size() ) std::cout << lfn[j].first <<
" ";
117 else std::cout <<
" ";
118 if ( j < pfn.size() ) std::cout << pfn[j].first <<
" ";
119 else std::cout <<
" ";
120 if ( j < attrs.size() ) std::cout << attrs[j].first <<
" " << attrs[j].second <<
" ";
121 else std::cout <<
" ";
122 std::cout << std::endl;
127 std::cout <<
"Used " << end <<
" seconds (" << (long)fids.size()*mult <<
" entries)."
128 <<
" Corresponding to " << float(end)/float(fids.size()*mult) <<
" entries/second."
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
virtual std::string lookupLFN(CSTR lfn) const
Lookup file identifier by logical file name.
virtual bool existsLFN(CSTR lfn) const
Return the status of a logical file name.
virtual void setMetaData(CSTR fid, CSTR name, CSTR value) const
Insert/update metadata item.
virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const
Create a FileID and Node of the physical file name with all the attributes.
virtual void init()
Parse the DOM tree of the XML catalog.
virtual bool dirty() const
Check if the catalog should be updated.
virtual void getFID(Strings &fids) const
Dump all file Identifiers.
virtual std::string lookupPFN(CSTR fid) const
Lookup file identifier by physical file name.
virtual void getLFN(CSTR fid, Files &files) const
Dump all logical file names of the catalog associate to the FileID.
virtual bool existsPFN(CSTR pfn) const
Return the status of a physical file name.
virtual void commit()
Save DOM catalog to file.
virtual void getPFN(CSTR fid, Files &files) const
Dump all physical file names of the catalog and their attributes associate to the FileID...
int testXMLFileCatalogWrite(int argc, char **argv)
virtual void getMetaData(CSTR fid, Attributes &attr) const
Dump all MetaData of the catalog for a given file ID.
virtual void registerFID(CSTR fid) const
Create a FileID and Node.
This is a number of static methods for bootstrapping the Gaudi framework.
This class constitutes the core of the XML based FileCatalog API for POOL.
virtual std::string createFID() const
Catalog interface.
virtual void registerLFN(CSTR fid, CSTR lfn) const
Create a FileID and Node of the logical file name with all the attributes.
int testXMLFileCatalogRead(int argc, char **argv)