Go to the documentation of this file.
26 constexpr
struct select2nd_t {
27 template <
typename S,
typename T>
33 template <
typename InputIterator,
typename OutputIterator,
typename UnaryOperation,
typename UnaryPredicate>
34 OutputIterator transform_copy_if( InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op,
35 UnaryPredicate pred ) {
36 while ( first != last ) {
37 auto val = op( *first );
38 if ( pred( val ) ) *result++ =
std::move( val );
45 using namespace Gaudi;
93 []( ConnectionMap::const_reference i ) {
return i.second->connection; },
104 return error(
"Failed to connect to data:" + dsn,
false );
111 return error(
"Failed to connect to data:" + dsn,
false );
134 if ( ::strncasecmp( dsn.
c_str(),
"FID:", 4 ) == 0 )
135 dsn = dataset.
substr( 4 );
136 else if ( ::strncasecmp( dsn.
c_str(),
"LFN:", 4 ) == 0 )
137 dsn = dataset.
substr( 4 );
138 else if ( ::strncasecmp( dsn.
c_str(),
"PFN:", 4 ) == 0 )
139 dsn = dataset.
substr( 4 );
152 if (
c->isConnected() ) {
154 c->disconnect().ignore( );
155 log <<
MSG::INFO <<
"Disconnect from dataset " << dsn <<
" [" << fid <<
"]" <<
endmsg;
173 case Connection::UPDATE:
175 case Connection::RECREATE:
185 select2nd, [&](
Entry* i ) {
189 if ( !to_retire.
empty() ) {
193 c->disconnect().ignore( );
194 log <<
MSG::INFO <<
"Disconnect from dataset " <<
c->pfn() <<
" [" <<
c->fid() <<
"]" <<
endmsg;
211 if ( !con )
return error(
"Severe logic bug: No connection object avalible.",
true );
213 if ( con->isConnected() ) {
219 Connection*
c = i->second->connection;
221 m_incSvc->fireIncident(
Incident( con->name(), IncidentType::FailInputFile ) );
222 return error(
"Severe logic bug: Twice identical connection object for DSN:" + con->name(),
true );
230 Connection* connection ) {
235 if ( ::strncasecmp( dsn.
c_str(),
"FID:", 4 ) == 0 )
236 dsn = dataset.
substr( 4 ), typ = FID;
237 else if ( ::strncasecmp( dsn.
c_str(),
"LFN:", 4 ) == 0 )
238 dsn = dataset.
substr( 4 ), typ = LFN;
239 else if ( ::strncasecmp( dsn.
c_str(),
"PFN:", 4 ) == 0 )
240 dsn = dataset.
substr( 4 ), typ = PFN;
253 if ( files.
empty() ) {
257 error(
"connectDataIO> failed to resolve FID:" + dsn,
false ).
ignore();
259 }
else if ( dsn.
length() == 36 && dsn[8] ==
'-' && dsn[13] ==
'-' ) {
268 error(
"connectDataIO> Failed to resolve FID:" + dsn,
false ).
ignore();
275 for (
auto i = files.
cbegin(); i != files.
cend(); ++i ) {
277 if ( i != files.
cbegin() ) {
278 log <<
MSG::WARNING <<
"Attempt to connect dsn:" << dsn <<
" with next entry in data federation:" << pfn
292 log <<
MSG::ERROR <<
"Failed to open dsn:" << dsn <<
" Federated file could not be resolved from "
307 log <<
MSG::ERROR <<
"Failed to resolve LFN:" << dsn <<
" Cannot access this dataset." <<
endmsg;
314 if ( files.
empty() ) {
317 m_catalog->registerPFN( fid, dsn, technology );
318 log <<
MSG::INFO <<
"Referring to dataset " << dsn <<
" by its file ID:" << fid <<
endmsg;
340 error(
"connectDataIO> Cannot connect to database: PFN=" + dsn +
" FID=" + fid,
false ).
ignore();
347 log <<
MSG::ERROR <<
"Referring to existing dataset " << dsn <<
" by its physical name." <<
endmsg;
348 log <<
"You may not be able to navigate back to the input file"
349 <<
" -- processing continues" <<
endmsg;
359 error(
"connectDataIO> Cannot connect to database: PFN=" + dsn +
" FID=" + fid,
false ).
ignore();
367 }
else if ( typ == LFN ) {
375 error(
"connectDataIO> The dataset " + dsn +
" cannot be opened.",
false ).
ignore();
StatusCode initialize() override
IDataConnection * connection
Gaudi::Property< bool > m_quarantine
Connections connections(const IInterface *owner) const override
Get connection by owner instance (0=ALL)
StatusCode connectRead(bool keep_open, Connection *ioDesc) override
Open data stream in read mode.
Gaudi::Property< bool > m_useGFAL
T back_inserter(T... args)
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.
StatusCode establishConnection(Connection *con)
StatusCode connectWrite(Connection *con, IoType mode=Connection::CREATE, CSTR doctype="UNKNOWN") override
Open data stream in write mode.
void resetAge()
Reset age.
StatusCode error(CSTR msg, bool rethrow)
Small routine to issue exceptions.
StatusCode finalize() override
virtual StatusCode connectRead()=0
Open data stream in read mode.
GAUDI_API long breakExecution()
Break the execution of the application and invoke the debugger.
Gaudi::Property< int > m_ageLimit
ConnectionMap m_connectionMap
Map with I/O descriptors.
const std::string & name() const override
Retrieve name of the service
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Connection * connection(const std::string &dsn) const override
Retrieve known connection.
StatusCode read(Connection *ioDesc, void *const data, size_t len) override
Read raw byte buffer from input stream.
StatusCode initialize() override
IService implementation: initialize the service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode finalize() override
IService implementation: finalize the service.
Gaudi::Property< std::string > m_catalogSvcName
StatusCode write(Connection *con, const void *data, int len) override
Write raw byte buffer to output stream.
SmartIF< IFileCatalog > m_catalog
Reference to file catalog.
virtual StatusCode connectWrite(IoType type)=0
Open data stream in write mode.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
StatusCode disconnect(Connection *ioDesc) override
Release data stream.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
StatusCode reconnect(Entry *e)
constexpr static const auto SUCCESS
long long int seek(Connection *ioDesc, long long int where, int origin) override
Seek on the file described by ioDesc. Arguments as in ::seek()
FidMap m_fidMap
Map of FID to PFN.
#define DECLARE_COMPONENT(type)
Gaudi::Property< bool > m_disablePFNWarning
constexpr static const auto FAILURE
SmartIF< IIncidentSvc > m_incSvc
StatusCode connectDataIO(int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection *con)
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator