ATLAS Offline Software
Loading...
Searching...
No Matches
MetaDataSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#include "MetaDataSvc.h"
11
12#include "Gaudi/Interfaces/IOptionsSvc.h"
13#include "GaudiKernel/IAlgTool.h"
14#include "GaudiKernel/IEvtSelector.h"
15#include "GaudiKernel/IIncidentSvc.h"
16#include "GaudiKernel/IIoComponentMgr.h"
17#include "GaudiKernel/IOpaqueAddress.h"
18#include "GaudiKernel/FileIncident.h"
19#include "GaudiKernel/System.h"
20
25
27
28#include <algorithm>
29#include <cctype>
30#include <vector>
31#include <sstream>
32#include <functional>
33
34namespace {
42 bool leftString(std::string& s, char sc) {
43 if (const auto pos = s.find(sc); pos != std::string::npos) {
44 s.resize(pos);
45 return true;
46 }
47 return false;
48 }
49}
50
51
52//________________________________________________________________________________
53MetaDataSvc::MetaDataSvc( const std::string& name, ISvcLocator* pSvcLocator )
54 : base_class( name, pSvcLocator )
55 , m_inputDataStore( "StoreGateSvc/InputMetaDataStore", name )
56 , m_outputDataStore( "StoreGateSvc/MetaDataStore", name )
57 , m_fileMgr( "FileMgr", name )
58 , m_incSvc( "IncidentSvc", name )
59 , m_outSeqSvc( "OutputStreamSequencerSvc", name )
60{}
61
62//________________________________________________________________________________
64
65//__________________________________________________________________________
67 ATH_MSG_INFO("Initializing {}", name());
68
69 // Retrieve InputMetaDataStore
70 ATH_CHECK( m_inputDataStore.retrieve() );
71 // Retrieve OutputMetaDataStore
72 ATH_CHECK( m_outputDataStore.retrieve() );
73 // Retrieve AddressCreator
74 ATH_CHECK( m_addrCrtr.retrieve() );
75
76 AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_addrCrtr.operator->());
77 if (cnvSvc) {
78 m_storageType = cnvSvc->repSvcType();
79 } else {
80 ATH_MSG_WARNING("Cannot get ConversionSvc Interface.");
81 }
82 // Get FileMgr
83 ATH_CHECK( m_fileMgr.retrieve() );
84
85 // Set to be listener for end of event
86 ATH_CHECK( m_incSvc.retrieve() );
87
88 ATH_CHECK( m_metaDataTools.retrieve() );
89 ATH_MSG_INFO("Found " << m_metaDataTools);
90
91 m_incSvc->addListener(this, "FirstInputFile", 80, true);
92 m_incSvc->addListener(this, "BeginInputFile", 80, true);
93 m_incSvc->addListener(this, "EndInputFile", 10, true);
94 m_incSvc->addListener(this, "BeginInputMemFile", 80, true);
95 m_incSvc->addListener(this, "EndInputMemFile", 10, true);
96
97 // Register this service for 'I/O' events
98 ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", this->name());
99 ATH_CHECK( iomgr.retrieve() );
100 ATH_CHECK( iomgr->io_register(this) );
101
102 ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc("JobOptionsSvc", name());
103 if (!joSvc.retrieve().isSuccess()) {
104 ATH_MSG_WARNING("Cannot get JobOptionsSvc.");
105 } else {
106 if (joSvc->has("EventSelector.InputCollections")) {
107 // Get EventSelector to force in-time initialization and FirstInputFile incident
108 ServiceHandle<IEvtSelector> evtsel("EventSelector", this->name());
109 if (!evtsel.retrieve().isSuccess()) {
110 ATH_MSG_WARNING("Cannot get EventSelector.");
111 }
112 }
113 }
114 // retrieve the output sequences service (EventService) if available
115 m_outSeqSvc.retrieve().ignore();
116
117 return(StatusCode::SUCCESS);
118}
119//__________________________________________________________________________
121 // Release IncidentService
122 if (!m_incSvc.release().isSuccess()) {
123 ATH_MSG_WARNING("Cannot release IncidentService.");
124 }
125 // Release FileMgr
126 if (!m_fileMgr.release().isSuccess()) {
127 ATH_MSG_WARNING("Cannot release FileMgr.");
128 }
129 // Release AddressCreator
130 if (!m_addrCrtr.release().isSuccess()) {
131 ATH_MSG_WARNING("Cannot release AddressCreator.");
132 }
133 // Release OutputMetaDataStore
134 if (!m_outputDataStore.release().isSuccess()) {
135 ATH_MSG_WARNING("Cannot release OutputMetaDataStore.");
136 }
137 // Release InputMetaDataStore
138 if (!m_inputDataStore.release().isSuccess()) {
139 ATH_MSG_WARNING("Cannot release InputMetaDataStore.");
140 }
142 ATH_MSG_WARNING("EndInputFile was not received before finalize");
143 }
144 return(StatusCode::SUCCESS);
145}
146
147//__________________________________________________________________________
148StatusCode MetaDataSvc::stop() {
149 ATH_MSG_DEBUG("MetaDataSvc::stop()");
150 // Fire metaDataStopIncident
151 Incident metaDataStopIncident(name(), "MetaDataStop");
152 m_incSvc->fireIncident(metaDataStopIncident);
153 return(StatusCode::SUCCESS);
154}
155
156//________________________________________________________________________________
158 if (storeID != StoreID::METADATA_STORE) { // should this (also) run in the INPUT_METADATA_STORE?
159 return(StatusCode::SUCCESS);
160 }
161 if (!m_inputDataStore->contains<DataHeader>( name()) ) {
162 return(StatusCode::SUCCESS);
163 }
164 const DataHeader* dataHeader = nullptr;
165 ATH_CHECK( m_inputDataStore->retrieve( dataHeader, name()) );
166 for (const DataHeaderElement& dhe : *dataHeader) {
167 const CLID clid = dhe.getPrimaryClassID();
168 if (clid != ClassID_traits<DataHeader>::ID()) {
169 tads.push_back(dhe.getAddress(m_storageType, dhe.getKey()));
170 }
171 }
172 return(StatusCode::SUCCESS);
173}
174//________________________________________________________________________________
175StatusCode MetaDataSvc::newMetadataSource(const Incident& inc)
176{
177 const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
178 if (fileInc == nullptr) {
179 ATH_MSG_ERROR("Unable to get FileName from EndInputFile incident");
180 return StatusCode::FAILURE;
181 }
182 const std::string guid = fileInc->fileGuid();
183 const std::string fileName = fileInc->fileName();
184 m_allowMetaDataStop = false;
186 if (!fileName.starts_with( "BSF:")) {
187 // the input file is _not_ bytestream
189 if (!m_inputDataStore->clearStore().isSuccess()) {
190 ATH_MSG_WARNING("Unable to clear input MetaData Proxies");
191 }
193 }
195 }
196 StatusCode rc{StatusCode::SUCCESS};
197 for (auto& tool : m_metaDataTools) {
198 ATH_MSG_DEBUG(" calling beginInputFile on {} for GUID \"{}\"",
199 tool->name(), guid);
200 if (tool->beginInputFile(guid).isFailure()) {
201 ATH_MSG_ERROR("Unable to call beginInputFile for {}", tool->name());
202 rc = StatusCode::FAILURE;
203 }
204 }
205 return rc;
206}
207
208StatusCode MetaDataSvc::retireMetadataSource(const Incident& inc)
209{
210 const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
211 if (fileInc == nullptr) {
212 ATH_MSG_ERROR("Unable to get FileName from EndInputFile incident");
213 return StatusCode::FAILURE;
214 }
215 const std::string guid = fileInc->fileGuid();
216 ATH_MSG_DEBUG("retireMetadataSource: {}", fileInc->fileName());
217 for (auto& tool : m_metaDataTools) {
218 ATH_MSG_DEBUG(" calling endInputFile on {} for GUID \"{}\"",
219 tool->name(), guid);
220 ATH_CHECK(tool->endInputFile(guid));
221 }
222 m_allowMetaDataStop = true;
223 return StatusCode::SUCCESS;
224}
225
227{
228 if (m_outputPrepared) {
229 return StatusCode::SUCCESS;
230 }
231
232 StatusCode rc{StatusCode::SUCCESS};
233 for (auto& tool : m_metaDataTools) {
234 ATH_MSG_DEBUG(" calling metaDataStop for {}", tool->name());
235 if (tool->metaDataStop().isFailure()) {
236 ATH_MSG_ERROR("Unable to call metaDataStop for {}", tool->name());
237 rc = StatusCode::FAILURE;
238 }
239 }
240 if (!m_metaDataTools.release().isSuccess()) {
241 ATH_MSG_WARNING("Cannot release " << m_metaDataTools);
242 }
243
244 m_outputPrepared = true;
245 return rc;
246}
247
248// like prepareOutput() but for parallel streams
249StatusCode MetaDataSvc::prepareOutput(const std::string& outputName)
250{
251 // default to the serial implementation if no output name given
252 if( outputName.empty() ) {
253 return prepareOutput();
254 }
255 ATH_MSG_DEBUG( "prepareOutput('{}')", outputName );
256
257 StatusCode rc{StatusCode::SUCCESS};
258 for (auto& tool : m_metaDataTools) {
259 ATH_MSG_DEBUG(" calling metaDataStop for {}", tool->name());
260 // planning to replace the call below with (*it)->prepareOutput(outputName)
261 if (tool->metaDataStop().isFailure()) {
262 ATH_MSG_ERROR("Unable to call metaDataStop for {}", tool->name());
263 rc = StatusCode::FAILURE;
264 }
265 }
266 // MN: not releasing tools here - revisit when clear what happens on new file open
267 return rc;
268}
269
270
271StatusCode MetaDataSvc::shmProxy(const std::string& tokenStr)
272{
273 if (m_addrCrtr.name() != "AthenaPoolSharedIOCnvSvc") {
274 ATH_MSG_ERROR("shmProxy failed: unsupported AddressCreator " << m_addrCrtr.name());
275 return StatusCode::FAILURE;
276 }
277
279 ATH_CHECK(m_inputDataStore->clearStore(true));
281 }
283 ATH_CHECK(m_outputDataStore->clearStore(true));
285 }
286
288 return StatusCode::SUCCESS;
289}
290
291//__________________________________________________________________________
292void MetaDataSvc::handle(const Incident& inc) {
293 const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
294 if (fileInc == nullptr) {
295 ATH_MSG_ERROR("Unable to get FileName from EndInputFile incident");
296 return;
297 }
298 const std::string fileName = fileInc->fileName();
299 ATH_MSG_DEBUG("handle() {} for {}", inc.type(), fileName);
300
301 if (inc.type() == "FirstInputFile") {
302 // Register open/close callback actions
303 using namespace std::placeholders;
304 Io::bfcn_action_t boa = std::bind(&MetaDataSvc::rootOpenAction, this, _1, _2);
305 if (m_fileMgr->regAction(std::move(boa), Io::OPEN).isFailure()) {
306 ATH_MSG_FATAL("Cannot register ROOT file open action with FileMgr.");
307 }
308 if (!initInputMetaDataStore(fileName).isSuccess()) {
309 ATH_MSG_WARNING("Unable to initialize InputMetaDataStore");
310 }
311 } else if (inc.type() == "BeginInputFile" || inc.type() == "BeginInputMemFile") {
312 if(newMetadataSource(inc).isFailure()) {
313 ATH_MSG_ERROR("Could not process new metadata source {}", fileName);
314 }
315 } else if (inc.type() == "EndInputFile" || inc.type() == "EndInputMemFile") {
316 if(retireMetadataSource(inc).isFailure()) {
317 ATH_MSG_ERROR("Could not retire metadata source {}", fileName);
318 }
319 }
320}
321
322//__________________________________________________________________________
323// This method is currently called only from OutputStreamSequencerSvc
324StatusCode MetaDataSvc::transitionMetaDataFile(const std::string& outputConn, bool disconnect)
325{
326 ATH_MSG_DEBUG("transitionMetaDataFile: {}", outputConn );
327
328 // this is normally called through EndInputFile inc, simulate it for EvSvc
329 FileIncident inc("transitionMetaDataFile", "EndInputFile", "dummyMetaInputFileName", "");
331
332 // Reset flag to allow calling prepareOutput again at next transition
333 m_outputPrepared = false;
334
335 Incident metaDataStopIncident(name(), "MetaDataStop");
336 m_incSvc->fireIncident(metaDataStopIncident);
337
338 if( disconnect ) {
339 AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_addrCrtr.operator->());
340 if (cnvSvc) {
341 if (!cnvSvc->disconnectOutput(outputConn).isSuccess()) {
342 ATH_MSG_WARNING("Cannot get disconnect Output Files");
343 }
344 }
345 }
346
347 return(StatusCode::SUCCESS);
348}
349
350//__________________________________________________________________________
352 ATH_MSG_INFO("I/O reinitialization...");
353 ATH_MSG_DEBUG("Dumping InputMetaDataStore: {}", m_inputDataStore->dump());
354 ATH_MSG_DEBUG("Dumping OutputMetaDataStore: {}", m_outputDataStore->dump());
355 for (const auto& tool : m_metaDataTools) {
356 ATH_MSG_INFO("Attached MetaDataTool: {}", tool->name());
357 }
358 m_outputPrepared = false;
359 return(StatusCode::SUCCESS);
360}
361//__________________________________________________________________________
362StatusCode MetaDataSvc::rootOpenAction(FILEMGR_CALLBACK_ARGS) {
363 return(StatusCode::SUCCESS);
364}
365//__________________________________________________________________________
366// check if the metadata object key contains Stream name (added by SharedWriter in MetaDataSvc)
367// remove stream part from the key (i.e. modify the parameter) and return it
368std::string MetaDataSvc::removeStreamFromKey(std::string& key) {
369 size_t pos = key.find(m_streamInKeyMark);
370 if( pos==std::string::npos ) return "";
371 size_t epos = key.find(']', pos);
372 size_t spos = pos + m_streamInKeyMark.size();
373 std::string stream = key.substr( spos, epos - spos );
374 //cppcheck-suppress uselessCallsSubstr
375 key = key.substr(0, pos) + key.substr(epos+1);
376 return stream;
377}
378
379//__________________________________________________________________________
380[[nodiscard]] std::set<std::string> MetaDataSvc::getPerStreamKeysFor(const std::string& key) const {
381 if (!m_streamKeys.contains(key)) {
382 return {key};
383 }
384 return m_streamKeys.at(key);
385}
386
387//__________________________________________________________________________
388StatusCode MetaDataSvc::addProxyToInputMetaDataStore(const std::string& tokenStr) {
389 std::string fileName = tokenStr.substr(tokenStr.find("[FILE=") + 6);
390 leftString(fileName, ']');
391 std::string className = tokenStr.substr(tokenStr.find("[PNAME=") + 7);
392 leftString(className, ']');
393 std::string contName = tokenStr.substr(tokenStr.find("[CONT=") + 6);
394 leftString(contName,']');
395 std::size_t pos1 = contName.find('(');
396 std::string keyName = contName.substr(pos1 + 1, contName.size() - pos1 - 2);
397 std::size_t pos2 = keyName.find('/');
398 if (pos2 != std::string::npos) keyName = keyName.substr(pos2 + 1);
399 std::string numName = tokenStr.substr(tokenStr.find("[NUM=") + 5);
400 leftString(numName,']');
401 unsigned long num = 0;
402 std::istringstream iss(numName);
403 iss >> num;
404 // className is the persistent class sent by the client ([PNAME=]). xAOD metadata is written by
405 // T_AthenaPoolxAODCnv / T_AthenaPoolAuxContainerCnv, whose persistent class is the transient
406 // class, known to ClassIDSvc by its type-info name. The T/P metadata classes (EventStreamInfo,
407 // IOVMetaDataContainer, ByteStreamMetadataContainer) are named <transient>_p<N>, and ClassIDSvc
408 // knows <transient>; that is a convention, not enforced (PyUtils/MetaReader.py relies on it too).
409 // A metadata class that fits neither fails here.
410 CLID clid = CLID_NULL;
411 if (m_classIDSvc->getIDOfTypeInfoName(className, clid).isFailure()) {
412 const std::size_t ppos = className.rfind("_p");
413 const bool isTP = ppos != std::string::npos && ppos + 2 < className.size()
414 && std::all_of(className.begin() + ppos + 2, className.end(), [](unsigned char c) { return std::isdigit(c); });
415 if (!isTP || m_classIDSvc->getIDOfTypeName(className.substr(0, ppos), clid).isFailure()) {
416 ATH_MSG_ERROR("addProxyToInputMetaDataStore: no CLID for persistent class {} in {}", className, tokenStr);
417 return StatusCode::FAILURE;
418 }
419 }
420
421 // make stream-unique keys for infile metadata objects
422 // AthenaOutputStream will use this to distribute objects to the right stream (and restore the original key)
423 if( clid == 178309087 ) { // FileMetaData
424 std::string newName = std::format("{}{}{}{}", keyName, m_streamInKeyMark, fileName, "]");
425 ATH_MSG_DEBUG("Recording {} as {}", keyName, newName);
426 m_streamKeys[keyName].insert(newName);
427 keyName = std::move(newName);
428 }
429 if( clid == 73252552 ) { // FileMetaDataAuxInfo
430 std::string newName = std::format("{}{}{}]{}",
431 keyName.substr(0, keyName.find(RootAuxDynIO::AUX_POSTFIX)),
433 fileName,
435 ATH_MSG_DEBUG("Recording {} as {}", keyName, newName);
436 m_streamKeys[keyName].insert(newName);
437 keyName = std::move(newName);
438 }
439 const std::string par[3] = { "SHM" , keyName , std::move(className) };
440 const unsigned long ipar[2] = { num , 0 };
441 IOpaqueAddress* opqAddr = nullptr;
442 SG::DataProxy* dp = m_inputDataStore->proxy(clid, keyName);
443 if (dp != nullptr) {
444 ATH_MSG_DEBUG("Resetting duplicate proxy for: {}#{} from file: {}",
445 clid, keyName, fileName);
446 dp->reset();
447 }
448 if (!m_addrCrtr->createAddress(m_storageType, clid, par, ipar, opqAddr).isSuccess()) {
449 ATH_MSG_FATAL("addProxyToInputMetaDataStore: Cannot create address for {}", tokenStr);
450 return(StatusCode::FAILURE);
451 }
452 if (m_inputDataStore->recordAddress(keyName, opqAddr).isFailure()) {
453 ATH_MSG_FATAL("addProxyToInputMetaDataStore: Cannot create proxy for {}", tokenStr);
454 return(StatusCode::FAILURE);
455 }
456 if (m_inputDataStore->accessData(clid, keyName) == nullptr) {
457 ATH_MSG_FATAL("addProxyToInputMetaDataStore: Cannot access data for {}", tokenStr);
458 return(StatusCode::FAILURE);
459 }
460 if (keyName.find(RootAuxDynIO::AUX_POSTFIX) != std::string::npos
461 && m_inputDataStore->symLink(clid, keyName, 187169987).isFailure()) {
462 ATH_MSG_WARNING("addProxyToInputMetaDataStore: Cannot symlink to AuxStore for {}", tokenStr);
463 }
464 return(StatusCode::SUCCESS);
465}
466//__________________________________________________________________________
467StatusCode MetaDataSvc::initInputMetaDataStore(const std::string& fileName) {
468 ATH_MSG_DEBUG("initInputMetaDataStore: file name {}", fileName);
470 // Load proxies for InputMetaDataStore
471 if (m_metaDataCont.value().empty()) {
472 ATH_MSG_DEBUG("MetaDataSvc called without MetaDataContainer set.");
473 return(StatusCode::SUCCESS);
474 }
475 if (fileName.starts_with( "BSF:")) {
476 ATH_MSG_DEBUG("MetaDataSvc called for non ROOT file.");
477 } else if (fileName.compare(0, 3, "SHM")==0) {
478 ATH_MSG_DEBUG("MetaDataSvc called for shared memory.");
479 } else {
480 const std::string par[2] = {
481 fileName,
482 std::format("{}(DataHeader)", m_metaDataCont.value())
483 };
484 const std::string parOld[2] = {
485 fileName,
486 std::format("{}{}", m_metaDataCont.value(), "DataHeader")
487 };
488 if (m_inputDataStore->contains<DataHeader>(name())) {
489 ATH_MSG_DEBUG("initInputMetaDataStore: MetaData Store already contains DataHeader, key = {}", name());
490 } else {
491 const unsigned long ipar[2] = { 0 , 0 };
492 IOpaqueAddress* opqAddr = nullptr;
493 if (m_addrCrtr->createAddress(m_storageType, ClassID_traits<DataHeader>::ID(), par, ipar, opqAddr).isSuccess()
494 || m_addrCrtr->createAddress(m_storageType, ClassID_traits<DataHeader>::ID(), parOld, ipar, opqAddr).isSuccess()) {
495 if (m_inputDataStore->recordAddress(name(), opqAddr).isFailure()) {
496 ATH_MSG_WARNING("initInputMetaDataStore: Cannot create proxy for DataHeader, key = {}", name());
497 }
498 }
499 }
500 std::list<SG::TransientAddress*> tList;
502 for (SG::TransientAddress* tad : tList) {
503 CLID clid = tad->clID();
504 ATH_MSG_VERBOSE("initInputMetaDataStore: add proxy for clid = {}, key = {}",
505 clid, tad->name());
506 if (m_inputDataStore->contains(tad->clID(), tad->name())) {
507 ATH_MSG_DEBUG("initInputMetaDataStore: MetaData Store already contains clid = {}, key = {}",
508 clid, tad->name());
509 } else {
510 if (!m_inputDataStore->recordAddress(tad->name(), tad->address())) {
511 ATH_MSG_ERROR("initInputMetaDataStore: Cannot create proxy for clid = {}, key = {}",
512 clid, tad->name());
513 return StatusCode::FAILURE;
514 }
515 }
516
517 for (CLID tclid : tad->transientID()) {
518 if (tclid != clid) {
519 if (m_inputDataStore->symLink (clid, tad->name(), tclid).isFailure()) {
520 ATH_MSG_WARNING("Cannot make autosymlink from {}/{} to {}",
521 clid, tad->name(), tclid);
522 }
523 }
524 }
525 delete tad;
526 }
527 tList.clear();
528 }
529 ATH_MSG_DEBUG("Loaded input meta data store proxies");
530 return(StatusCode::SUCCESS);
531}
532
533
534const std::string MetaDataSvc::currentRangeID() const
535{
536 const EventContext& ctx = Gaudi::Hive::currentContext();
537 return m_outSeqSvc.isValid()? m_outSeqSvc->currentRangeID(ctx) : "";
538}
539
540
542{
543 if (!m_handledClasses.contains(itemID)) {
544 ATH_MSG_DEBUG("Not translating metadata item ID #{}", itemID);
545 return itemID;
546 }
547
548 std::string itemName;
549 CLID contID = 0;
550 if (m_classIDSvc->getTypeNameOfID(itemID, itemName).isSuccess()) {
551 const std::string contName = std::format("MetaCont<{}>", itemName);
552 ATH_MSG_DEBUG("Transforming {} to {} for output",
553 contName, itemName);
554 if (m_classIDSvc->getIDOfTypeName(contName, contID).isSuccess())
555 return contID;
556 }
557
558 return itemID;
559}
560
561void MetaDataSvc::recordHook(const std::type_info& typeInfo) {
562 const std::string& typeName = System::typeinfoName(typeInfo);
563 ATH_MSG_VERBOSE("Handling record event of type {}", typeName);
564
565 CLID itemID = 0;
566 if (m_classIDSvc->getIDOfTypeInfoName(typeName, itemID).isSuccess()) {
567 auto result = m_handledClasses.insert(itemID);
568 if (result.second)
569 ATH_MSG_DEBUG("MetaDataSvc will handle {} ClassID: {}", typeName, itemID);
570 }
571}
572
573void MetaDataSvc::removeHook(const std::type_info& typeInfo) {
574 const std::string& typeName = System::typeinfoName(typeInfo);
575 ATH_MSG_VERBOSE("Handling removal event of type {}", typeName);
576
577 CLID itemID = 0;
578 if (m_classIDSvc->getIDOfTypeInfoName(typeName, itemID).isSuccess()) {
579 if (0 < m_handledClasses.erase(itemID))
580 ATH_MSG_DEBUG("MetaDataSvc will no longer handle {} ClassID: {}",
581 typeName, itemID);
582 }
583}
584
586 ATH_MSG_DEBUG("Locking metadata tools");
587 for(auto& tool : m_metaDataTools ) {
588 const ILockableTool *lockable = dynamic_cast<const ILockableTool*>( tool.get() );
589 if( lockable ) lockable->lock_shared();
590 }
591}
592
594 ATH_MSG_DEBUG("Unlocking metadata tools");
595 for(auto& tool : m_metaDataTools ) {
596 const ILockableTool *lockable = dynamic_cast<const ILockableTool*>( tool.get() );
597 if( lockable ) lockable->unlock_shared();
598 }
599}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
This file contains the class definition for the DataHeader and DataHeaderElement classes.
uint32_t CLID
The Class ID type.
static Double_t sc
static Double_t rc
This file contains the class definition for the MetaDataSvc class.
This file contains the class definition for the OutputStreamSequencerSvc class.
Base class for all conversion services.
Definition AthCnvSvc.h:66
virtual long repSvcType() const override
Retrieve the class type of the data store the converter uses.
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
This class provides a persistent form for the TransientAddress.
Definition DataHeader.h:37
This class provides the layout for summary information stored for data written to POOL.
Definition DataHeader.h:123
std::list< SG::TransientAddress * > tadList
Provide an interface for locking and unlocking a tool externally.
virtual void lock_shared() const =0
Lock the tool.
virtual void unlock_shared() const =0
Unlock the tool.
ServiceHandle< OutputStreamSequencerSvc > m_outSeqSvc
virtual StatusCode prepareOutput()
Makes the metadata store ready for output.
long m_storageType
std::map< std::string, std::set< std::string > > m_streamKeys
static constexpr std::string_view m_streamInKeyMark
marker string for embedding stream name in MetaData object keys for SharedWriter server
virtual StatusCode newMetadataSource(const Incident &)
Fills the input metadata store with the content of the new input file.
virtual StatusCode initialize() override
initialize the metadata service at the beginning of the job
void recordHook(const std::type_info &) override
MetaDataSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.
void lockTools() const
bool m_beginInputFileSeen
PublicToolHandleArray< IMetaDataTool > m_metaDataTools
MetaDataTools, vector with the MetaData tools.
virtual void handle(const Incident &incident) override
react to file incidents.
ServiceHandle< StoreGateSvc > m_outputDataStore
virtual StatusCode io_reinit() override
Implements IIoComponent interface sets m_outputPrepared to false and prints some information.
StatusCode transitionMetaDataFile(const std::string &outputConn, bool disconnect)
Transition output metadata file - fire MeteDataStop incident to transition OutputStream and disconnec...
CLID remapMetaContCLID(const CLID &item_id) const
StatusCode rootOpenAction(FILEMGR_CALLBACK_ARGS)
ServiceHandle< StoreGateSvc > m_inputDataStore
virtual ~MetaDataSvc()
Destructor.
virtual StatusCode retireMetadataSource(const Incident &)
Allows metadata tools to act before an input file is closed.
std::set< CLID > m_handledClasses
bool m_allowMetaDataStop
ServiceHandle< IAddressCreator > m_addrCrtr
virtual StatusCode finalize() override
finalize the metadata service at the end of the job
StatusCode initInputMetaDataStore(const std::string &fileName)
Initialize input metadata store - can be called directly or via BeginInputFile incident.
virtual StatusCode stop() override
stop the metadata service
ServiceHandle< IIncidentSvc > m_incSvc
std::string removeStreamFromKey(std::string &key)
check if the metadata object key contains Stream name (added by SharedWriter in MetaDataSvc) remove s...
virtual const std::string currentRangeID() const override final
StatusCode addProxyToInputMetaDataStore(const std::string &tokenStr)
ServiceHandle< IFileMgr > m_fileMgr
void removeHook(const std::type_info &) override
bool m_clearedOutputDataStore
StatusCode loadAddresses(StoreID::type storeID, IAddressProvider::tadList &tads) override
loads addresses of metadata object.
bool m_outputPrepared
void unlockTools() const
Gaudi::Property< std::string > m_metaDataCont
MetaDataContainer, POOL container name for MetaData.
bool m_clearedInputDataStore
ServiceHandle< IClassIDSvc > m_classIDSvc
virtual std::set< std::string > getPerStreamKeysFor(const std::string &key) const override final
Get all per-stream Key variants created for in-file metadata object with original key If no stream-sp...
@ METADATA_STORE
Definition StoreID.h:29
virtual StatusCode shmProxy(const std::string &tokenStr) override
Loads file metadata from memory shared between streams in SharedWriter This function clears the input...
constexpr char AUX_POSTFIX[]
Common post-fix for the names of auxiliary containers in StoreGate.