test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Namespaces | Classes | Enumerations | Functions
cond::persistency Namespace Reference

Namespaces

 GLOBAL_TAG
 
 GLOBAL_TAG_MAP
 
 IOV
 
 PAYLOAD
 
 TAG
 
 TAG_LOG
 

Classes

struct  AttributeTypeName
 
struct  AttributeTypeName< boost::posix_time::ptime >
 
struct  AttributeTypeName< cond::Binary >
 
struct  AttributeTypeName< cond::SynchronizationType >
 
struct  AttributeTypeName< cond::TimeType >
 
class  BasePayloadProxy
 
class  BulkInserter
 
class  CondDBTransaction
 
class  CondGetter
 
class  ConnectionPool
 
struct  DefineQueryOutput
 
struct  DefineQueryOutput< boost::posix_time::ptime >
 
struct  DefineQueryOutput< cond::Binary >
 
struct  DefineQueryOutput< cond::SynchronizationType >
 
struct  DefineQueryOutput< cond::TimeType >
 
struct  DefineQueryOutput< std::array< char, n > >
 
class  DeleteBuffer
 
class  Exception
 Base exception class for the object to relational access. More...
 
struct  GetFromRow
 
struct  GetFromRow< boost::posix_time::ptime >
 
struct  GetFromRow< cond::Binary >
 
struct  GetFromRow< cond::SynchronizationType >
 
struct  GetFromRow< cond::TimeType >
 
struct  GetFromRow< std::array< char, n > >
 
class  GTEditor
 
class  GTEditorData
 
class  GTProxy
 
class  GTProxyData
 
class  GTSchema
 
class  IGTMapTable
 
class  IGTSchema
 
class  IGTTable
 
class  IIOVSchema
 
class  IIOVTable
 
struct  IOVComp
 
class  IOVEditor
 
class  IOVEditorData
 
class  IOVProxy
 
class  IOVProxyData
 
class  IOVSchema
 
class  IPayloadMigrationTable
 
class  IPayloadTable
 
class  ITagLogTable
 
class  ITagMigrationTable
 
class  ITagTable
 
class  ITransaction
 
class  KeyList
 
class  PayloadProxy
 
class  PayloadProxy< cond::persistency::KeyList >
 
class  PayloadReader
 
class  Query
 
class  QueryIterator
 
class  RowBuffer
 
class  Session
 
class  SessionImpl
 
class  TableDescription
 
class  Transaction
 
class  TransactionScope
 
class  UpdateBuffer
 

Enumerations

enum  DbAuthenticationSystem { UndefinedAuthentication =0, CondDbKey, CoralXMLFile }
 
enum  UpdatePolicy { NEW =0, UPDATE, REPLACE }
 

Functions

std::string convertoToOracleConnection (const std::string &input)
 
bool copyIov (Session &session, const std::string &sourceTag, const std::string &destTag, cond::Time_t souceSince, cond::Time_t destSince, const std::string &description, bool log)
 
size_t copyTag (const std::string &sourceTag, Session &sourceSession, const std::string &destTag, Session &destSession, UpdatePolicy policy, bool log)
 
unsigned int countslash (const std::string &input)
 
template<typename T >
void f_add_column_description (coral::TableDescription &table, const std::string &columnName, size_t size=0, bool notNull=true)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetch (const cond::Hash &payloadId, Session &session)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetchIfExists (const cond::Hash &payloadId, Session &session, bool &exists)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetchOne (const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr)
 
std::string fullyQualifiedTag (const std::string &tag, const std::string &connectionString)
 
std::pair< std::string,
std::string > 
getConnectionParams (const std::string &connectionString, const std::string &transactionId, const std::string &signature)
 
std::string getConnectionProtocol (const std::string &connectionString)
 
cond::Hash import (Session &source, const cond::Hash &sourcePayloadId, const std::string &inputTypeName, const void *inputPtr, Session &destination)
 
size_t importIovs (const std::string &sourceTag, Session &sourceSession, const std::string &destTag, Session &destSession, cond::Time_t begin, cond::Time_t end, const std::string &description, bool log)
 
bool iovSorter (const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &f, const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &s)
 
template<typename T , typename Arg1 >
bool is_same_any ()
 
template<typename T , typename Arg1 , typename Arg2 , typename... Args>
bool is_same_any ()
 
cond::Hash makeHash (const std::string &objectType, const cond::Binary &data)
 
std::tuple< std::string,
std::string, std::string > 
parseConnectionString (const std::string &connectionString)
 
std::string parseFipConnectionString (const std::string &fipConnect)
 
std::pair< std::string,
std::string > 
parseTag (const std::string &tag)
 
template<typename T >
std::vector< T >::const_iterator search (const cond::Time_t &val, const std::vector< T > &container)
 
template<typename T , typename P >
void static_assert_is_same_decayed ()
 
void throwException (const std::string &message, const std::string &methodName)
 

Enumeration Type Documentation

Enumerator
UndefinedAuthentication 
CondDbKey 
CoralXMLFile 

Definition at line 28 of file ConnectionPool.h.

Enumerator
NEW 
UPDATE 
REPLACE 

Definition at line 14 of file CondDBTools.h.

Function Documentation

std::string cond::persistency::convertoToOracleConnection ( const std::string &  input)
inline

Definition at line 116 of file Utils.h.

References match(), matches, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by CondDBESSource::CondDBESSource().

116  {
117 
118  // leave the connection string unmodified for sqlite
119  if( input.find("sqlite") == 0 || input.find("oracle") == 0) return input;
120 
121  //static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)");
122  static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)");
123  static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)");
124  static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)");
125 
126  static const std::map<std::string, std::string> frontierMap = {
127  {"PromptProd", "cms_orcon_adg"},
128  {"FrontierProd", "cms_orcon_adg"},
129  {"FrontierArc", "cms_orcon_adg"},
130  {"FrontierOnProd", "cms_orcon_adg"},
131  {"FrontierPrep", "cms_orcoff_prep"},
132  };
133 
134  boost::smatch matches;
135 
136  static const std::string technology("oracle://");
137  std::string service("");
138  std::string account("");
139 
140  bool match = false;
141  if (boost::regex_match(input, matches, short_frontier)){
142  service = matches[1];
143  account = matches[2];
144  match = true;
145  }
146 
147  if (boost::regex_match(input, matches, long_frontier)) {
148  std::string frontier_config(matches[1]);
149  boost::smatch matches2;
150  if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl))
151  throwException("No serverurl in matched long frontier","convertoToOracleConnection");
152  service = matches2[1];
153  account = matches[3];
154  match = true;
155  }
156 
157  if( !match ) throwException("Connection string "+input+" can't be converted to oracle connection.","convertoToOracleConnection");
158 
159  if( service == "FrontierArc" ){
160  size_t len = account.size()-5;
161  account = account.substr(0,len);
162  }
163 
164  auto it = frontierMap.find( service );
165  if( it == frontierMap.end() ) throwException("Connection string can't be converted.","convertoToOracleConnection");
166  service = it->second;
167 
168  return technology+service+"/"+account;
169  }
static std::string const input
Definition: EdmProvDump.cc:44
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
bool cond::persistency::copyIov ( Session session,
const std::string &  sourceTag,
const std::string &  destTag,
cond::Time_t  souceSince,
cond::Time_t  destSince,
const std::string &  description,
bool  log 
)

Definition at line 163 of file CondDBTools.cc.

References gather_cfg::cout, cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, cond::persistency::IOVProxy::end(), cond::persistency::Session::existsIov(), cond::persistency::IOVProxy::find(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), cond::persistency::IOVProxy::loadedSize(), AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::IOVEditor::payloadType(), cond::persistency::Session::readIov(), cond::persistency::IOVEditor::setDescription(), cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVEditor::timeType(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

169  {
170  persistency::TransactionScope ssc( session.transaction() );
171  ssc.start( false );
172  if( log ) std::cout <<" Loading source iov..."<<std::endl;
173  persistency::IOVProxy p = session.readIov( sourceTag, true );
174  if( p.loadedSize()==0 ) {
175  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
176  return false;
177  } else {
178  if( log ) std::cout <<" Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
179  }
180 
181  auto iiov = p.find( sourceSince );
182  if( iiov == p.end() ){
183  if( log ) std::cout <<"ERROR: No Iov valid found for target time "<<sourceSince<<std::endl;
184  return false;
185  }
186 
187  persistency::IOVEditor editor;
188  if( session.existsIov( destTag ) ){
189  editor = session.editIov( destTag );
190  if( editor.timeType() != p.timeType() )
191  throwException( "TimeType of the destination tag does not match with the source tag timeType.", "importIovs");
192  if( editor.payloadType() != p.payloadObjectType() )
193  throwException( "PayloadType of the destination tag does not match with the source tag payloadType.", "importIovs");
194  } else {
195  editor = session.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
196  if( description.empty() ) editor.setDescription( "Created copying iovs from tag "+sourceTag );
197  else editor.setDescription( description );
198  }
199 
200  editor.insert( destSince, (*iiov).payloadId );
201 
202  if( log ) std::cout <<" Flushing changes..."<<std::endl;
203  editor.flush();
204  ssc.commit();
205  return true;
206  }
tuple description
Definition: idDealer.py:66
tuple editor
Definition: idDealer.py:73
tuple cout
Definition: gather_cfg.py:145
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
size_t cond::persistency::copyTag ( const std::string &  sourceTag,
Session sourceSession,
const std::string &  destTag,
Session destSession,
UpdatePolicy  policy,
bool  log 
)

Definition at line 15 of file CondDBTools.cc.

References cond::persistency::Session::clearIov(), cond::persistency::Session::connectionString(), gather_cfg::cout, cond::persistency::Session::createDatabase(), cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, cond::persistency::Session::existsDatabase(), cond::persistency::Session::existsIov(), fetch(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), o2o::iov, cond::persistency::IOVProxy::loadedSize(), NEW, AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::Session::readIov(), REPLACE, cond::persistency::Transaction::rollback(), cond::persistency::IOVEditor::setDescription(), EcalCondDB::sinces, cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

20  {
21  persistency::TransactionScope ssc( sourceSession.transaction() );
22  ssc.start();
23  if( log ) std::cout <<" Loading source iov..."<<std::endl;
24  persistency::IOVProxy p = sourceSession.readIov( sourceTag, true );
25  if( p.loadedSize()==0 ) {
26  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
27  return 0;
28  }
29  if( log ) std::cout <<" Copying tag. Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
30 
31  persistency::IOVEditor editor;
32  persistency::TransactionScope dsc( destSession.transaction() );
33  dsc.start( false );
34  bool exists = false;
35  if( !destSession.existsDatabase() ) {
36  destSession.createDatabase();
37  } else {
38  exists = destSession.existsIov( destTag );
39  }
40  if( exists ){
41  if( policy == REPLACE ){
42  destSession.clearIov( destTag );
43  } else if( policy == NEW ){
44  destSession.transaction().rollback();
45  throwException(" Tag \""+destTag+"\" already exists.","copyTag");
46  }
47  editor = destSession.editIov( destTag );
48  } else {
49  editor = destSession.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
50  }
51  editor.setDescription("Tag "+sourceTag+" migrated from "+sourceSession.connectionString());
52 
53  size_t niovs = 0;
54  std::set<cond::Hash> pids;
55  std::set<cond::Time_t> sinces;
56  for( auto iov : p ){
57  // skip duplicated sinces
58  if( sinces.find( iov.since ) != sinces.end() ){
59  if( log ) std::cout <<" WARNING. Skipping duplicated since="<<iov.since<<std::endl;
60  continue;
61  }
62  sinces.insert( iov.since );
63  // make sure that we import the payload _IN_USE_
64  auto usedIov = p.getInterval( iov.since );
65  std::pair<std::string,boost::shared_ptr<void> > readBackPayload = fetch( usedIov.payloadId, sourceSession );
66  cond::Hash ph = import( sourceSession, usedIov.payloadId, readBackPayload.first, readBackPayload.second.get(), destSession );
67  editor.insert( iov.since, ph );
68  pids.insert( ph );
69  niovs++;
70  if( log && niovs && (niovs%1000==0) ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
71  }
72  if( log ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
73  if( log ) std::cout <<" Flushing changes..."<<std::endl;
74  editor.flush();
75  dsc.commit();
76  ssc.commit();
77  return niovs;
78  }
list sinces
Definition: EcalCondDB.py:80
tuple iov
Definition: o2o.py:307
std::string Hash
Definition: Types.h:45
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
Definition: CondDBFetch.cc:313
tuple editor
Definition: idDealer.py:73
tuple cout
Definition: gather_cfg.py:145
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
unsigned int cond::persistency::countslash ( const std::string &  input)

Definition at line 13 of file DbConnectionString.cc.

References KineDebug3::count().

Referenced by getConnectionParams().

13  {
14  unsigned int count = 0;
15  std::string::size_type slashpos( 0 );
16  while( slashpos != std::string::npos ) {
17  slashpos = input.find('/', slashpos );
18  if( slashpos != std::string::npos ) {
19  ++count;
20  // start next search after this word
21  slashpos += 1;
22  }
23  }
24  return count;
25  }
uint16_t size_type
static std::string const input
Definition: EdmProvDump.cc:44
template<typename T >
void cond::persistency::f_add_column_description ( coral::TableDescription &  table,
const std::string &  columnName,
size_t  size = 0,
bool  notNull = true 
)

Definition at line 205 of file DbCore.h.

References findQualityFiles::size.

205  {
206  table.insertColumn( columnName, AttributeTypeName<T>()(), size );
207  if( notNull ) table.setNotNullConstraint( columnName );
208  }
tuple size
Write out results.
std::pair< std::string, boost::shared_ptr< void > > cond::persistency::fetch ( const cond::Hash payloadId,
Session session 
)

Definition at line 313 of file CondDBFetch.cc.

References data, fetchOne(), cond::persistency::Session::fetchPayloadData(), newFWLiteAna::found, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by copyTag(), LMFDat::fetch(), and importIovs().

313  {
314  boost::shared_ptr<void> payloadPtr;
316  cond::Binary streamerInfo;
317  std::string payloadTypeName;
318  bool found = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
319  if( !found ) throwException( "Payload with id "+boost::lexical_cast<std::string>(payloadId)+" has not been found in the database.","fetch" );
320  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr );
321  }
std::pair< std::string, boost::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr)
Definition: CondDBFetch.cc:23
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
std::pair<std::string,boost::shared_ptr<void> > cond::persistency::fetchIfExists ( const cond::Hash payloadId,
Session session,
bool &  exists 
)

Definition at line 24 of file CondDBImport.cc.

References data, fetchOne(), cond::persistency::Session::fetchPayloadData(), and AlCaHLTBitMon_QueryRunRegistry::string.

24  {
25  boost::shared_ptr<void> payloadPtr;
27  cond::Binary streamerInfo;
28  std::string payloadTypeName;
29  exists = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
30  if( exists ) {
31  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr );
32  } else return std::make_pair( std::string(""), boost::shared_ptr<void>() );
33  }
std::pair< std::string, boost::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr)
Definition: CondDBFetch.cc:23
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::pair< std::string, boost::shared_ptr< void > > cond::persistency::fetchOne ( const std::string &  payloadTypeName,
const cond::Binary data,
const cond::Binary streamerInfo,
boost::shared_ptr< void >  payloadPtr 
)

Definition at line 23 of file CondDBFetch.cc.

References data, FETCH_PAYLOAD_CASE, match(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by fetch(), and fetchIfExists().

23  {
24 
25  bool match = false;
27  FETCH_PAYLOAD_CASE( std::vector<unsigned long long> )
165  FETCH_PAYLOAD_CASE( JME::JetResolutionObject )
203  FETCH_PAYLOAD_CASE( l1t::CaloParams )
204  FETCH_PAYLOAD_CASE( l1t::CaloConfig )
219  FETCH_PAYLOAD_CASE( lumi::LumiSectionData )
224  FETCH_PAYLOAD_CASE( PhysicsTools::Calibration::MVAComputerContainer )
233  //FETCH_PAYLOAD_CASE( PerformancePayload )
280  FETCH_PAYLOAD_CASE( cond::BaseKeyed )
291 
292  //
293  if( payloadTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
294  auto payload = deserialize<PhysicsTools::Calibration::Histogram3D<double,double,double,double> >(payloadTypeName, data, streamerInfo );
295  payloadPtr = payload;
296  match = true;
297  }
298  if( payloadTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
299  auto payload = deserialize<PhysicsTools::Calibration::Histogram2D<double,double,double> >(payloadTypeName, data, streamerInfo );
300  payloadPtr = payload;
301  match = true;
302  }
303  if( payloadTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
304  auto payload = deserialize<std::vector<unsigned long long> >( payloadTypeName, data, streamerInfo );
305  payloadPtr = payload;
306  match = true;
307  }
308 
309  if( ! match ) throwException( "Payload type \""+payloadTypeName+"\" is unknown.","fetch" );
310  return std::make_pair( payloadTypeName, payloadPtr );
311  }
Definition: ESGain.h:7
tuple lumi
Definition: fjr2json.py:35
#define FETCH_PAYLOAD_CASE(TYPENAME)
Definition: CondDBFetch.cc:3
Definition: DTT0.h:53
Histogram3D< double > HistogramD3D
Definition: Histogram3D.h:187
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
if(dp >Float(M_PI)) dp-
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
std::string cond::persistency::fullyQualifiedTag ( const std::string &  tag,
const std::string &  connectionString 
)

Definition at line 8 of file GTProxy.cc.

Referenced by CondDBESSource::CondDBESSource().

8  {
9  if(connectionString.empty()) return tag;
10  return tag+"@["+connectionString+"]";
11  }
string connectionString
Definition: autoCondHLT.py:4
std::pair< std::string, std::string > cond::persistency::getConnectionParams ( const std::string &  connectionString,
const std::string &  transactionId,
const std::string &  signature 
)

Definition at line 39 of file DbConnectionString.cc.

References autoCondHLT::connectionString, countslash(), getConnectionProtocol(), edm::Service< T >::isAvailable(), cmsLHEtoEOSManager::l, edm::SiteLocalConfig::lookupCalibConnect(), parseFipConnectionString(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

Referenced by cond::persistency::ConnectionPool::createCoralSession().

41  {
42  if( connectionString.empty() ) cond::throwException( "The connection string is empty.", "getConnectionParams" );
44  std::string finalConn = connectionString;
45  std::string refreshConn( "" );
46  if( protocol == "frontier" ) {
47  std::string protocol( "frontier://" );
48  std::string::size_type fpos = connectionString.find( protocol );
49  unsigned int nslash = countslash( connectionString.substr( protocol.size(), connectionString.size() - fpos ) );
50  if( nslash==1 ) {
51  edm::Service<edm::SiteLocalConfig> localconfservice;
52  if( !localconfservice.isAvailable() ) {
53  cond::throwException( "edm::SiteLocalConfigService is not available", "getConnectionParams" );
54  }
55  finalConn = localconfservice->lookupCalibConnect( connectionString );
56  }
57  if( !transactionId.empty() ) {
58  size_t l = finalConn.rfind('/');
59  finalConn.insert( l, "(freshkey="+transactionId+')' );
60  }
61 
62  //When the signature parameter is set to sig, FroNTier requests that the server sends digital signatures on every response.
63  //We test here that the signature string, if defined, is actually set to sig, otherwise we throw an exception
64  std::string signatureParameter( "sig" );
65  if( !signature.empty() ) {
66  if( signature.compare( signatureParameter ) == 0 ) {
67  std::string::size_type s = finalConn.rfind('/');
68  finalConn.insert( s, "(security="+signature+')' );
69  } else {
70  cond::throwException( "The FroNTier security option is invalid.", "getConnectionParams" );
71  }
72  }
73 
74  std::string::size_type startRefresh = finalConn.find( "://" );
75  if( startRefresh != std::string::npos ) {
76  startRefresh += 3;
77  }
78  std::string::size_type endRefresh=finalConn.rfind( "/", std::string::npos );
79  if( endRefresh == std::string::npos ) {
80  refreshConn = finalConn;
81  } else {
82  refreshConn = finalConn.substr( startRefresh, endRefresh - startRefresh );
83  if( refreshConn.substr( 0, 1 ) != "(" ) {
84  //if the connect string is not a complicated parenthesized string,
85  // an http:// needs to be at the beginning of it
86  refreshConn.insert( 0, "http://" );
87  }
88  }
89  } else if( protocol == "sqlite_fip" ) {
91  }
92  return std::make_pair( finalConn, refreshConn );
93  }
std::string getConnectionProtocol(const std::string &connectionString)
Definition: Utils.h:85
std::string parseFipConnectionString(const std::string &fipConnect)
virtual std::string const lookupCalibConnect(std::string const &input) const =0
uint16_t size_type
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:21
bool isAvailable() const
Definition: Service.h:46
string connectionString
Definition: autoCondHLT.py:4
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined signature
Definition: Activities.doc:4
unsigned int countslash(const std::string &input)
std::string cond::persistency::getConnectionProtocol ( const std::string &  connectionString)
inline

Definition at line 85 of file Utils.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by getConnectionParams(), and parseConnectionString().

85  {
86  size_t techEnd = connectionString.find( ':' );
87  if( techEnd == std::string::npos ) throwException( "Could not resolve the connection protocol on "+connectionString+".",
88  "getConnectionProtocol" );
89  std::string technology = connectionString.substr(0,techEnd);
90  return technology;
91  }
string connectionString
Definition: autoCondHLT.py:4
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
cond::Hash cond::persistency::import ( Session source,
const cond::Hash sourcePayloadId,
const std::string &  inputTypeName,
const void *  inputPtr,
Session destination 
)

Definition at line 35 of file CondDBImport.cc.

References cmsStageWithFailover::destination, IMPORT_PAYLOAD_CASE, match(), getGTfromDQMFile::obj, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

35  {
36  cond::Hash payloadId("");
37  bool newInsert = false;
38  bool match = false;
39  if( inputPtr ){
41  IMPORT_PAYLOAD_CASE( std::vector<unsigned long long> )
177  IMPORT_PAYLOAD_CASE( JME::JetResolutionObject )
215  IMPORT_PAYLOAD_CASE( l1t::CaloParams )
216  IMPORT_PAYLOAD_CASE( l1t::CaloConfig )
231  if( inputTypeName == "L1TriggerKeyList" ){
232  match = true;
233  throwException( "Import of \"L1TriggerKeyList\" type payloads is not supported.","import" );
234  }
235  //IMPORT_PAYLOAD_CASE( L1TriggerKeyList )
243  IMPORT_PAYLOAD_CASE( PhysicsTools::Calibration::MVAComputerContainer )
250  //IMPORT_PAYLOAD_CASE( PerformancePayload )
299  IMPORT_PAYLOAD_CASE( cond::BaseKeyed )
309  if( inputTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
310  match = true;
312  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
313  }
314  if( inputTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
315  match = true;
317  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
318  }
319  if( inputTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
320  match = true;
321  const std::vector<unsigned long long>& obj = *static_cast<const std::vector<unsigned long long>*>( inputPtr );
322  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
323  }
324 
325  if( ! match ) throwException( "Payload type \""+inputTypeName+"\" is unknown.","import" );
326  }
327  return payloadId;
328  }
Definition: ESGain.h:7
Definition: DTT0.h:53
Histogram3D< double > HistogramD3D
Definition: Histogram3D.h:187
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
#define IMPORT_PAYLOAD_CASE(TYPENAME)
Definition: CondDBImport.cc:4
std::string Hash
Definition: Types.h:45
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
if(dp >Float(M_PI)) dp-
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
size_t cond::persistency::importIovs ( const std::string &  sourceTag,
Session sourceSession,
const std::string &  destTag,
Session destSession,
cond::Time_t  begin,
cond::Time_t  end,
const std::string &  description,
bool  log 
)

Definition at line 85 of file CondDBTools.cc.

References begin, cond::persistency::IOVProxy::begin(), cond::persistency::Session::connectionString(), gather_cfg::cout, cond::persistency::Session::createDatabase(), cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, end, cond::persistency::IOVProxy::end(), cond::persistency::Session::existsDatabase(), cond::persistency::Session::existsIov(), fetch(), cond::persistency::IOVProxy::find(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVEditor::insert(), cond::persistency::IOVProxy::loadedSize(), AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::IOVEditor::payloadType(), cond::persistency::Session::readIov(), cond::persistency::IOVEditor::setDescription(), EcalCondDB::sinces, cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVEditor::timeType(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

92  {
93  persistency::TransactionScope ssc( sourceSession.transaction() );
94  ssc.start();
95  if( log ) std::cout <<" Loading source iov..."<<std::endl;
96  persistency::IOVProxy p = sourceSession.readIov( sourceTag, true );
97  if( p.loadedSize()==0 ) {
98  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
99  return 0;
100  } else {
101  if( log ) std::cout <<" Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
102  }
103  if( (*p.begin()).since > begin ) begin = (*p.begin()).since;
104  if( end < begin ) {
105  if( log ) std::cout <<" No Iov in the selected range."<<std::endl;
106  return 0;
107  }
108  persistency::IOVEditor editor;
109  persistency::TransactionScope dsc( destSession.transaction() );
110  dsc.start( false );
111  bool exists = false;
112  if( !destSession.existsDatabase() ) {
113  destSession.createDatabase();
114  } else {
115  exists = destSession.existsIov( destTag );
116  }
117  if( exists ){
118  editor = destSession.editIov( destTag );
119  if( editor.timeType() != p.timeType() )
120  throwException( "TimeType of the destination tag does not match with the source tag timeType.", "importIovs");
121  if( editor.payloadType() != p.payloadObjectType() )
122  throwException( "PayloadType of the destination tag does not match with the source tag payloadType.", "importIovs");
123  } else {
124  editor = destSession.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
125  if( description.empty() ) editor.setDescription( "Created copying tag "+sourceTag+" from "+sourceSession.connectionString() );
126  else editor.setDescription( description );
127  }
128  size_t niovs = 0;
129  std::set<cond::Hash> pids;
130  std::set<cond::Time_t> sinces;
131  auto iiov = p.find( begin );
132  cond::Time_t newSince = begin;
133  while( iiov != p.end() ){
134  // skip duplicated sinces
135  if( sinces.find( newSince ) != sinces.end() ){
136  if( log ) std::cout <<" WARNING. Skipping duplicated since="<<newSince<<std::endl;
137  continue;
138  }
139  sinces.insert( newSince );
140  // make sure that we import the payload _IN_USE_
141  auto usedIov = p.getInterval( newSince );
142  std::pair<std::string,boost::shared_ptr<void> > readBackPayload = fetch( usedIov.payloadId, sourceSession );
143  cond::Hash ph = import( sourceSession, usedIov.payloadId, readBackPayload.first, readBackPayload.second.get(), destSession );
144  editor.insert( newSince, ph );
145  pids.insert( ph );
146  niovs++;
147  if( log && niovs && (niovs%1000==0) ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
148  iiov++;
149  if( iiov == p.end() || (*iiov).since > end ){
150  break;
151  } else {
152  newSince = (*iiov).since;
153  }
154  }
155  if( log ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
156  if( log ) std::cout <<" Flushing changes..."<<std::endl;
157  editor.flush();
158  dsc.commit();
159  ssc.commit();
160  return niovs;
161  }
list sinces
Definition: EcalCondDB.py:80
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:45
#define end
Definition: vmac.h:37
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
Definition: CondDBFetch.cc:313
tuple description
Definition: idDealer.py:66
tuple editor
Definition: idDealer.py:73
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:145
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
bool cond::persistency::iovSorter ( const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &  f,
const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &  s 
)

Definition at line 151 of file IOVEditor.cc.

References f.

Referenced by cond::persistency::IOVEditor::flush().

151  {
152  return std::get<0>(f) < std::get<0>(s);
153  }
double f[11][100]
template<typename T , typename Arg1 >
bool cond::persistency::is_same_any ( )

Definition at line 210 of file DbCore.h.

References relativeConstraints::value.

210  {
212  };
template<typename T , typename Arg1 , typename Arg2 , typename... Args>
bool cond::persistency::is_same_any ( )

Definition at line 214 of file DbCore.h.

214  {
215  return is_same_any<T, Arg1>() || is_same_any<T, Arg2, Args...>();
216  };
cond::Hash cond::persistency::makeHash ( const std::string &  objectType,
const cond::Binary data 
)

Definition at line 10 of file IOVSchema.cc.

References cond::Binary::data(), cond::hash, i, cond::Binary::size(), throwException(), and tmp.

Referenced by cond::persistency::PAYLOAD::Table::insertIfNew().

10  {
11  SHA_CTX ctx;
12  if( !SHA1_Init( &ctx ) ){
13  throwException( "SHA1 initialization error.","IOVSchema::makeHash");
14  }
15  if( !SHA1_Update( &ctx, objectType.c_str(), objectType.size() ) ){
16  throwException( "SHA1 processing error (1).","IOVSchema::makeHash");
17  }
18  if( !SHA1_Update( &ctx, data.data(), data.size() ) ){
19  throwException( "SHA1 processing error (2).","IOVSchema::makeHash");
20  }
21  unsigned char hash[SHA_DIGEST_LENGTH];
22  if( !SHA1_Final(hash, &ctx) ){
23  throwException( "SHA1 finalization error.","IOVSchema::makeHash");
24  }
25 
26  char tmp[SHA_DIGEST_LENGTH*2+1];
27  // re-write bytes in hex
28  for (unsigned int i = 0; i < 20; i++) {
29  ::sprintf(&tmp[i * 2], "%02x", hash[i]);
30  }
31  tmp[20*2] = 0;
32  return tmp;
33  }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Definition: Binary.cc:54
const void * data() const
Definition: Binary.cc:45
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
std::tuple<std::string,std::string,std::string> cond::persistency::parseConnectionString ( const std::string &  connectionString)
inline

Definition at line 93 of file Utils.h.

References getConnectionProtocol(), serviceName, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by CondDBESSource::CondDBESSource(), and CondDBESSource::fillTagCollectionFromGT().

93  {
96  std::string databaseName("");
97  if( protocol == "sqlite" || protocol == "sqlite_file" || protocol == "sqlite_fip" ){
98  databaseName = connectionString.substr( protocol.size()+1 );
99  } else if ( protocol == "oracle" || protocol == "frontier" ){
100  size_t ptr = protocol.size()+1;
101  if( connectionString.substr( ptr,2 )!="//" ) throwException( "Connection string "+connectionString+
102  " is invalid format for technology \""+
103  protocol+"\".","parseConnectionString" );
104  ptr += 2;
105  size_t serviceEnd = connectionString.find( '/', ptr );
106  if( serviceEnd == std::string::npos ) throwException( "Connection string "+connectionString+" is invalid.",
107  "parseConnectionString" );
108  serviceName = connectionString.substr( ptr, serviceEnd-ptr );
109  ptr = serviceEnd+1;
110  databaseName = connectionString.substr( ptr );
111  } else throwException( "Technology "+protocol+" is not known.","parseConnectionString" );
112 
113  return std::make_tuple( protocol, serviceName, databaseName );
114  }
std::string getConnectionProtocol(const std::string &connectionString)
Definition: Utils.h:85
static const std::string serviceName
string connectionString
Definition: autoCondHLT.py:4
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
std::string cond::persistency::parseFipConnectionString ( const std::string &  fipConnect)

Definition at line 27 of file DbConnectionString.cc.

References convertSQLitetoXML_cfg::connect, edm::FileInPath::fullPath(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getConnectionParams().

27  {
28  std::string connect( "sqlite_file:" );
29  std::string::size_type pos = fipConnect.find( ':' );
30  std::string fipLocation = fipConnect.substr( pos+1 );
31  edm::FileInPath fip( fipLocation );
32  connect.append( fip.fullPath() );
33  return connect;
34  }
uint16_t size_type
std::pair< std::string, std::string > cond::persistency::parseTag ( const std::string &  tag)

Definition at line 13 of file GTProxy.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and lumiQTWidget::t.

Referenced by CondDBESSource::CondDBESSource(), and CondDBESSource::setIntervalFor().

13  {
14  std::string pfn("");
15  std::string t(tag);
16  size_t pos = tag.rfind("[");
17  if( pos != std::string::npos && tag.size() >= pos+2 ){
18  if( tag[pos-1]=='@' && tag[tag.size()-1]==']' ) {
19  pfn = tag.substr( pos+1,tag.size()-pos-2 );
20  t = tag.substr( 0, pos-1 );
21  }
22  }
23  return std::make_pair( t, pfn );
24  }
template<typename T >
std::vector<T>::const_iterator cond::persistency::search ( const cond::Time_t val,
const std::vector< T > &  container 
)

Definition at line 282 of file IOVProxy.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by METAnalyzer::dqmBeginRun(), AlignmentMonitorTemplate::event(), and cond::persistency::IOVProxy::find().

282  {
283  if( !container.size() ) return container.end();
284  auto p = std::upper_bound( container.begin(), container.end(), val, IOVComp() );
285  return (p!= container.begin()) ? p-1 : container.end();
286  }
template<typename T , typename P >
void cond::persistency::static_assert_is_same_decayed ( )
inline

Definition at line 82 of file DbCore.h.

References relativeConstraints::value.

82  {
83  static_assert( std::is_same<typename std::decay<T>::type, typename std::decay<P>::type>::value, "Parameter types don't match with the RowBuffer types" );
84  };
type
Definition: HCALResponse.h:21
void cond::persistency::throwException ( const std::string &  message,
const std::string &  methodName 
)

Definition at line 14 of file Exception.cc.

Referenced by cond::CredentialStore::addUser(), L1CondDBPayloadWriterExt::analyze(), L1CondDBIOVWriterExt::analyze(), L1CondDBPayloadWriter::analyze(), L1CondDBIOVWriter::analyze(), cond::persistency::GTEditor::checkTransaction(), cond::persistency::IOVEditor::checkTransaction(), cond::persistency::GTProxy::checkTransaction(), cond::persistency::IOVProxy::checkTransaction(), convertoToOracleConnection(), copyIov(), copyTag(), cond::persistency::Session::coralSession(), cond::persistency::GLOBAL_TAG::Table::create(), cond::persistency::TAG::Table::create(), cond::persistency::GLOBAL_TAG_MAP::Table::create(), cond::persistency::PAYLOAD::Table::create(), cond::persistency::IOV::Table::create(), cond::persistency::TAG_LOG::Table::create(), cond::persistency::Session::createGlobalTag(), cond::persistency::Session::createIov(), cond::persistency::Session::createIovForPayload(), cond::persistency::Query< Types...>::currentRow(), fetch(), fetchOne(), cond::persistency::Session::fetchPayload(), cond::persistency::GTEditor::flush(), cond::persistency::IOVEditor::flush(), cond::persistency::KeyList::get(), getConnectionProtocol(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVProxy::getMetadata(), import(), importIovs(), cond::persistency::SessionImpl::isOra(), cond::persistency::GTEditor::load(), cond::persistency::GTProxy::load(), cond::persistency::IOVProxy::load(), cond::persistency::PayloadProxy< std::vector< cond::Time_t > >::loadPayload(), makeHash(), cond::persistency::Query< Types...>::next(), cond::persistency::SessionImpl::openDb(), cond::persistency::SessionImpl::openGTDb(), cond::persistency::SessionImpl::openIovDb(), cond::persistency::PayloadProxy< std::vector< cond::Time_t > >::operator()(), cond::persistency::GetFromRow< std::array< char, n > >::operator()(), parseConnectionString(), cond::CredentialStore::setPermission(), cond::CredentialStore::startSession(), cond::persistency::SessionImpl::startTransaction(), cond::persistency::Session::storePayload(), and cond::CredentialStore::updateConnection().

15  {
16  throw Exception( message, methodName );
17  }