CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::IOVEditor Class Reference

#include <IOVEditor.h>

Public Member Functions

unsigned int append (cond::Time_t sinceTime, const std::string &payloadToken)
 
void bulkAppend (std::vector< std::pair< cond::Time_t, std::string > > &values)
 Bulk append of iov chunck. More...
 
void bulkAppend (std::vector< cond::IOVElement > &values)
 
std::string create (cond::TimeType timetype)
 
std::string create (cond::TimeType timetype, cond::Time_t lastTill, const std::string &metadata)
 
std::string create (cond::TimeType timetype, cond::Time_t lastTill)
 
bool createIOVContainerIfNecessary ()
 
void deleteEntries (bool withPayload=false)
 
void editMetadata (std::string const &metadata, bool append=false)
 edit metadata More...
 
unsigned int freeInsert (cond::Time_t sinceTime, const std::string &payloadToken)
 insert a payload with known since in any position More...
 
size_t import (cond::DbSession &sourceSess, const std::string &sourceIovToken)
 
boost::shared_ptr
< IOVImportIterator
importIterator ()
 
unsigned int insert (cond::Time_t tillTime, const std::string &payloadToken)
 Assign a payload with till time. Returns the payload index in the iov sequence. More...
 
 IOVEditor ()
 
 IOVEditor (cond::DbSession &dbSess)
 
 IOVEditor (cond::DbSession &dbSess, const std::string &token)
 
 IOVEditor (const IOVEditor &rhs)
 
void load (const std::string &token)
 
IOVEditoroperator= (const IOVEditor &rhs)
 
cond::IOVProxy proxy () const
 
void reload ()
 
void setScope (cond::IOVSequence::ScopeType scope)
 set the scope More...
 
void stamp (std::string const &icomment, bool append=false)
 
TimeType timetype () const
 
std::string const & token () const
 
unsigned int truncate (bool withPayload=false)
 
void updateClosure (cond::Time_t newtillTime)
 Update the closure of the iov sequence. More...
 
 ~IOVEditor ()
 Destructor. More...
 

Private Member Functions

void debugInfo (std::ostream &co) const
 
void reportError (std::string message) const
 
void reportError (std::string message, cond::Time_t time) const
 
bool validTime (cond::Time_t time, cond::TimeType timetype) const
 
bool validTime (cond::Time_t time) const
 

Private Attributes

boost::shared_ptr
< cond::IOVProxyData
m_iov
 
bool m_isLoaded
 

Detailed Description

Definition at line 56 of file IOVEditor.h.

Constructor & Destructor Documentation

IOVEditor::IOVEditor ( )

Definition at line 168 of file IOVEditor.cc.

168  :
169  m_isLoaded(false),
170  m_iov(){
171  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
IOVEditor::~IOVEditor ( )

Destructor.

Definition at line 173 of file IOVEditor.cc.

173 {}
IOVEditor::IOVEditor ( cond::DbSession dbSess)
explicit

Definition at line 175 of file IOVEditor.cc.

175  :
176  m_isLoaded(false),
177  m_iov( new IOVProxyData( dbSess ) ){
178  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
IOVEditor::IOVEditor ( cond::DbSession dbSess,
const std::string &  token 
)

Definition at line 180 of file IOVEditor.cc.

181  :
182  m_isLoaded(false),
183  m_iov( new IOVProxyData( dbSess, token )){
184  }
std::string const & token() const
Definition: IOVEditor.cc:542
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
IOVEditor::IOVEditor ( const IOVEditor rhs)

Definition at line 186 of file IOVEditor.cc.

186  :
187  m_isLoaded( rhs.m_isLoaded ),
188  m_iov( rhs.m_iov ){
189  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147

Member Function Documentation

unsigned int IOVEditor::append ( cond::Time_t  sinceTime,
const std::string &  payloadToken 
)

Append a payload with known since time. The previous last payload's till time will be adjusted to the new payload since time. Returns the payload index in the iov sequence

Definition at line 416 of file IOVEditor.cc.

References cond::TimeTypeSpecs::endValue, o2o::iov, m_iov, m_isLoaded, reload(), reportError(), run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, cond::timeTypeSpecs, cond::updateIOV(), and validTime().

Referenced by Vispa.Views.PropertyView.PropertyView::addProperty(), cond::AlignSplitIOV::execute(), cond::persistency::OraIOVTable::insertOne(), python.seqvaluedict.seqdict::push(), BeautifulSoup.Tag::setString(), and TestFunct::WriteWithIOV().

417  {
418  if( m_iov->token.empty() ) {
419  reportError("cond::IOVEditor::appendIOV cannot append to non-existing IOV index");
420  }
421 
422  if( !m_isLoaded ){
423  reload();
424  }
425  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
426 
427  if(!validTime(sinceTime))
428  reportError("cond::IOVEditor::append time not in global range",sinceTime);
429 
430  if( !iov->iovs().empty() ){
431  //range check in case
432  cond::Time_t lastValidSince=iov->iovs().back().sinceTime();
433  if( sinceTime<= lastValidSince){
434  std::ostringstream errStr;
435  errStr << "IOVEditor::append Error: trying to append a since time " << lastValidSince
436  << " which is not larger than last since";
437  reportError(errStr.str(), sinceTime);
438  }
439  }
440 
441  // does it make sense? (in case of mixed till and since insertions...)
442  if (iov->lastTill()<=sinceTime) iov->updateLastTill( timeTypeSpecs[iov->timeType()].endValue );
443  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
444  unsigned int ret = iov->add(sinceTime,payloadToken, payloadClassName );
445  updateIOV( m_iov->dbSession, iov, m_iov->token );
446  return ret;
447  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
unsigned long long Time_t
Definition: Time.h:16
tuple iov
Definition: o2o.py:307
Time_t endValue
Definition: Time.h:46
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::bulkAppend ( std::vector< std::pair< cond::Time_t, std::string > > &  values)

Bulk append of iov chunck.

Definition at line 321 of file IOVEditor.cc.

References firstTime, o2o::iov, m_iov, m_isLoaded, reload(), reportError(), AlCaHLTBitMon_QueryRunRegistry::string, cond::updateIOV(), validTime(), and makeHLTPrescaleTable::values.

Referenced by cond::persistency::OraIOVTable::insertMany().

321  {
322  if (values.empty()) return;
323  if( !m_isLoaded ){
324  reload();
325  }
326  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
327  cond::Time_t firstTime = values.front().first;
328  cond::Time_t lastTime = values.back().first;
329  if(!validTime(firstTime))
330  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
331 
332  if(!validTime(lastTime))
333  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
334 
335  if(lastTime>= iov->lastTill() ||
336  ( !iov->iovs().empty() && firstTime<=iov->iovs().back().sinceTime())
337  )
338  reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
339 
340  for(std::vector< std::pair<cond::Time_t,std::string> >::const_iterator it=values.begin(); it!=values.end(); ++it){
341  std::string payloadClassName = m_iov->dbSession.classNameForItem( it->second );
342  iov->add(it->first,it->second,payloadClassName );
343  }
344  updateIOV( m_iov->dbSession, iov, m_iov->token );
345  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:16
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::bulkAppend ( std::vector< cond::IOVElement > &  values)

Definition at line 348 of file IOVEditor.cc.

References firstTime, o2o::iov, m_iov, m_isLoaded, reload(), reportError(), AlCaHLTBitMon_QueryRunRegistry::string, cond::updateIOV(), and validTime().

348  {
349  if (values.empty()) return;
350  if( !m_isLoaded ){
351  reload();
352  }
353  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
354  cond::Time_t firstTime = values.front().sinceTime();
355  cond::Time_t lastTime = values.back().sinceTime();
356  if(!validTime(firstTime))
357  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
358 
359  if(!validTime(lastTime))
360  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
361 
362  if(lastTime>=iov->lastTill() ||
363  ( !iov->iovs().empty() && firstTime<=iov->iovs().back().sinceTime())
364  ) reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
365 
366  for(std::vector< cond::IOVElement >::const_iterator it=values.begin(); it!=values.end(); ++it){
367  std::string payloadClassName = m_iov->dbSession.classNameForItem( it->token() );
368  iov->add(it->sinceTime(),it->token(),payloadClassName );
369  }
370 
371  updateIOV( m_iov->dbSession, iov, m_iov->token );
372  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:16
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
std::string IOVEditor::create ( cond::TimeType  timetype)

Definition at line 260 of file IOVEditor.cc.

References cond::insertIOV(), m_iov, and m_isLoaded.

Referenced by cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), cond::persistency::OraTagTable::insert(), and TestFunct::WriteWithIOV().

260  {
261  m_iov->data.reset( new cond::IOVSequence(timetype) );
262  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
263  m_isLoaded=true;
264  return m_iov->token;
265  }
TimeType timetype() const
Definition: IOVEditor.cc:538
std::string insertIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, bool swapOIds=false)
Definition: IOVEditor.cc:26
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
std::string IOVEditor::create ( cond::TimeType  timetype,
cond::Time_t  lastTill,
const std::string &  metadata 
)

Definition at line 267 of file IOVEditor.cc.

References cond::insertIOV(), m_iov, and m_isLoaded.

269  {
270  m_iov->data.reset( new cond::IOVSequence((int)timetype,lastTill, metadata) );
271  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
272  m_isLoaded=true;
273  return m_iov->token;
274  }
TimeType timetype() const
Definition: IOVEditor.cc:538
std::string insertIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, bool swapOIds=false)
Definition: IOVEditor.cc:26
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
std::string IOVEditor::create ( cond::TimeType  timetype,
cond::Time_t  lastTill 
)

Definition at line 277 of file IOVEditor.cc.

References cond::insertIOV(), m_iov, m_isLoaded, and AlCaHLTBitMon_QueryRunRegistry::string.

277  {
278  m_iov->data.reset( new cond::IOVSequence((int)timetype,lastTill, std::string(" ")) );
279  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
280  m_isLoaded=true;
281  return m_iov->token;
282  }
TimeType timetype() const
Definition: IOVEditor.cc:538
std::string insertIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, bool swapOIds=false)
Definition: IOVEditor.cc:26
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
bool IOVEditor::createIOVContainerIfNecessary ( )

Definition at line 249 of file IOVEditor.cc.

References cond::IOVSchemaUtility::createIOVContainer(), cond::IOVSchemaUtility::existsIOVContainer(), m_iov, and run_regression::ret.

Referenced by cond::ExportIOVUtilities::execute().

249  {
250  bool ret = false;
251  cond::IOVSchemaUtility schemaUtil( m_iov->dbSession );
252  if( !schemaUtil.existsIOVContainer() ){
253  schemaUtil.createIOVContainer();
254  ret = true;
255  }
256  return ret;
257  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::debugInfo ( std::ostream &  co) const
private

Definition at line 208 of file IOVEditor.cc.

References o2o::iov, m_iov, cond::TimeTypeSpecs::name, and cond::timeTypeSpecs.

Referenced by reportError().

208  {
209  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
210  co << "IOVEditor: ";
211  co << "db " << m_iov->dbSession.connectionString();
212  if(m_iov->token.empty()) {
213  co << " no token"; return;
214  }
215  if (!m_iov->data.get() ) {
216  co << " no iov for token " << m_iov->token;
217  return;
218  }
219  co << " iov token " << m_iov->token;
220  co << "\nStamp: " << iov->comment()
221  << "; time " << iov->timestamp()
222  << "; revision " << iov->revision();
223  co <<". TimeType " << cond::timeTypeSpecs[ iov->timeType()].name;
224  if( iov->iovs().empty() )
225  co << ". empty";
226  else
227  co << ". size " << iov->iovs().size()
228  << "; last since " << iov->iovs().back().sinceTime();
229  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
tuple iov
Definition: o2o.py:307
std::string name
Definition: Time.h:43
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::deleteEntries ( bool  withPayload = false)

Definition at line 504 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), reportError(), and AlCaHLTBitMon_QueryRunRegistry::string.

504  {
505  if( m_iov->token.empty() ) reportError("cond::IOVEditor::deleteEntries cannot delete to non-existing IOV sequence");
506  if( !m_isLoaded ){
507  reload();
508  }
509  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
510  if(withPayload){
511  std::string tokenStr;
512  IOVSequence::const_iterator payloadIt;
513  IOVSequence::const_iterator payloadItEnd=iov->piovs().end();
514  for(payloadIt=iov->piovs().begin();payloadIt!=payloadItEnd;++payloadIt){
515  tokenStr=payloadIt->token();
516  m_iov->dbSession.deleteObject( tokenStr );
517  }
518  }
519  m_iov->dbSession.deleteObject( m_iov->token );
520  iov->piovs().clear();
521  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
Container::const_iterator const_iterator
Definition: IOVSequence.h:28
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::editMetadata ( std::string const &  metadata,
bool  append = false 
)

edit metadata

Definition at line 385 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), and cond::updateIOV().

386  {
387  if( !m_isLoaded ){
388  reload();
389  }
390  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
391  iov->updateMetadata( metadata, append);
392  updateIOV( m_iov->dbSession, iov, m_iov->token );
393  }
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
tuple iov
Definition: o2o.py:307
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
Definition: IOVEditor.cc:416
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
unsigned int IOVEditor::freeInsert ( cond::Time_t  sinceTime,
const std::string &  payloadToken 
)

insert a payload with known since in any position

Definition at line 451 of file IOVEditor.cc.

References cond::TimeTypeSpecs::endValue, o2o::iov, m_iov, m_isLoaded, reload(), reportError(), run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, cond::timeTypeSpecs, cond::updateIOV(), and validTime().

452  {
453  if( m_iov->token.empty() ) {
454  reportError("cond::IOVEditor::freeInsert cannot append to non-existing IOV index");
455  }
456 
457  if( !m_isLoaded ){
458  reload();
459  }
460  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
461 
462  // if( m_iov->data->iov.empty() ) reportError("cond::IOVEditor::freeInsert cannot insert to empty IOV index");
463 
464 
465  if(!validTime(sinceTime))
466  reportError("cond::IOVEditor::freeInsert time not in global range",sinceTime);
467 
468 
469  // we do not support multiple iov with identical since...
470  if (m_iov->data->exist(sinceTime))
471  reportError("cond::IOVEditor::freeInsert sinceTime already existing",sinceTime);
472 
473 
474 
475  // does it make sense? (in case of mixed till and since insertions...)
476  if (iov->lastTill()<sinceTime) iov->updateLastTill( timeTypeSpecs[iov->timeType()].endValue );
477  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
478  unsigned int ret = iov->add(sinceTime,payloadToken, payloadClassName );
479  updateIOV( m_iov->dbSession, iov, m_iov->token );
480  return ret;
481  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
tuple iov
Definition: o2o.py:307
Time_t endValue
Definition: Time.h:46
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
size_t IOVEditor::import ( cond::DbSession sourceSess,
const std::string &  sourceIovToken 
)

Definition at line 523 of file IOVEditor.cc.

References importIterator().

524  {
525  boost::shared_ptr<IOVImportIterator> importer = importIterator();
526  importer->setUp( sourceSess, sourceIovToken );
527  return importer->importAll();
528  }
boost::shared_ptr< IOVImportIterator > importIterator()
Definition: IOVEditor.cc:531
boost::shared_ptr< IOVImportIterator > IOVEditor::importIterator ( )

Definition at line 531 of file IOVEditor.cc.

References m_iov, m_isLoaded, and reload().

Referenced by cond::ExportIOVUtilities::execute(), and import().

531  {
532  if( !m_isLoaded ){
533  reload();
534  }
535  return boost::shared_ptr<IOVImportIterator>( new IOVImportIterator( m_iov ));
536  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
unsigned int IOVEditor::insert ( cond::Time_t  tillTime,
const std::string &  payloadToken 
)

Assign a payload with till time. Returns the payload index in the iov sequence.

Definition at line 297 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), reportError(), run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, cond::updateIOV(), and validTime().

Referenced by BeautifulSoup.PageElement::_invert().

298  {
299  if( !m_isLoaded ){
300  reload();
301  }
302  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
303  if( iov->iovs().empty() )
304  reportError("cond::IOVEditor::insert cannot inser into empty IOV sequence",tillTime);
305 
306  if(!validTime(tillTime))
307  reportError("cond::IOVEditor::insert time not in global range",tillTime);
308 
309  if(tillTime<=iov->lastTill() )
310  reportError("cond::IOVEditor::insert IOV not in range",tillTime);
311 
312  cond::Time_t newSince=iov->lastTill()+1;
313  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
314  unsigned int ret = iov->add(newSince, payloadToken, payloadClassName);
315  iov->updateLastTill(tillTime);
316  updateIOV( m_iov->dbSession, iov, m_iov->token );
317  return ret;
318  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
unsigned long long Time_t
Definition: Time.h:16
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::load ( const std::string &  token)

Definition at line 202 of file IOVEditor.cc.

References m_iov, m_isLoaded, and token().

Referenced by cond::ExportIOVUtilities::execute(), MatrixToProcess.MatrixToProcess::getProcess(), MatrixToProcess.MatrixToProcess::listAll(), cond::persistency::IOVCache::load(), and cond::persistency::OraTagTable::update().

202  {
203  m_iov->token = token;
204  m_iov->refresh();
205  m_isLoaded = true;
206  }
std::string const & token() const
Definition: IOVEditor.cc:542
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
IOVEditor & IOVEditor::operator= ( const IOVEditor rhs)

Definition at line 191 of file IOVEditor.cc.

References m_iov, and m_isLoaded.

191  {
192  m_isLoaded = rhs.m_isLoaded;
193  m_iov = rhs.m_iov;
194  return *this;
195  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
IOVProxy IOVEditor::proxy ( ) const

Definition at line 546 of file IOVEditor.cc.

References m_iov.

Referenced by cond::ExportIOVUtilities::execute(), cond::persistency::IOVCache::iovSequence(), and cond::persistency::IOVCache::session().

546  {
547  return IOVProxy( m_iov );
548  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::reload ( )

Definition at line 197 of file IOVEditor.cc.

References m_iov, and m_isLoaded.

Referenced by append(), bulkAppend(), deleteEntries(), editMetadata(), cond::ExportIOVUtilities::execute(), freeInsert(), importIterator(), insert(), setScope(), stamp(), truncate(), and updateClosure().

197  {
198  m_iov->refresh();
199  m_isLoaded = true;
200  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::reportError ( std::string  message) const
private

Definition at line 231 of file IOVEditor.cc.

References debugInfo(), edm::hlt::Exception, python.rootplot.argparse::message, and dbtoconf::out.

Referenced by append(), bulkAppend(), deleteEntries(), freeInsert(), insert(), truncate(), and updateClosure().

231  {
232  std::ostringstream out;
233  out << "Error in ";
234  debugInfo(out);
235  out << "\n" << message;
236  throw cond::Exception(out.str());
237  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:208
tuple out
Definition: dbtoconf.py:99
void IOVEditor::reportError ( std::string  message,
cond::Time_t  time 
) const
private

Definition at line 239 of file IOVEditor.cc.

References debugInfo(), edm::hlt::Exception, dbtoconf::out, and cond::rpcobgas::time.

240  {
241  std::ostringstream out;
242  out << "Error in ";
243  debugInfo(out);
244  out << "\n" << message << " for time: " << time;
245  throw cond::Exception(out.str());
246  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:208
tuple out
Definition: dbtoconf.py:99
void IOVEditor::setScope ( cond::IOVSequence::ScopeType  scope)

set the scope

Definition at line 395 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), and cond::updateIOV().

Referenced by cond::ExportIOVUtilities::execute().

395  {
396  if( !m_isLoaded ){
397  reload();
398  }
399  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
400  iov->setScope( scope );
401  updateIOV( m_iov->dbSession, iov, m_iov->token );
402  }
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::stamp ( std::string const &  icomment,
bool  append = false 
)

Definition at line 375 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), and cond::updateIOV().

Referenced by cond::AlignSplitIOV::execute(), cond::persistency::OraTagTable::insert(), and cond::persistency::OraTagTable::update().

376  {
377  if( !m_isLoaded ){
378  reload();
379  }
380  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
381  iov->stamp(icomment, append);
382  updateIOV( m_iov->dbSession, iov, m_iov->token );
383  }
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
tuple iov
Definition: o2o.py:307
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
Definition: IOVEditor.cc:416
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
TimeType IOVEditor::timetype ( ) const

Definition at line 538 of file IOVEditor.cc.

References m_iov.

Referenced by cond::ExportIOVUtilities::execute(), and validTime().

538  {
539  return m_iov->data->timeType();
540  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
std::string const & IOVEditor::token ( ) const

Definition at line 542 of file IOVEditor.cc.

References m_iov.

Referenced by cond::AlignSplitIOV::execute(), cond::persistency::IOVCache::load(), load(), and TestFunct::WriteWithIOV().

542  {
543  return m_iov->token;
544  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
unsigned int IOVEditor::truncate ( bool  withPayload = false)

Definition at line 485 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), reportError(), run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and cond::updateIOV().

Referenced by Vispa.Gui.VispaWidget.TextField::calculateDimensions().

485  {
486  if( m_iov->token.empty() ) reportError("cond::IOVEditor::truncate cannot delete to non-existing IOV sequence");
487  if( !m_isLoaded ){
488  reload();
489  }
490  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
491  if (iov->piovs().empty()) return 0;
492  if(withPayload){
493  std::string tokenStr = iov->piovs().back().token();
494  m_iov->dbSession.deleteObject( tokenStr );
495  }
496  unsigned int ret = iov->truncate();
497  updateIOV( m_iov->dbSession, iov, m_iov->token );
498  return ret;
499 
500  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
void IOVEditor::updateClosure ( cond::Time_t  newtillTime)

Update the closure of the iov sequence.

Definition at line 405 of file IOVEditor.cc.

References o2o::iov, m_iov, m_isLoaded, reload(), reportError(), and cond::updateIOV().

Referenced by cond::persistency::OraTagTable::update().

405  {
406  if( m_iov->token.empty() ) reportError("cond::IOVEditor::updateClosure cannot change non-existing IOV index");
407  if( !m_isLoaded ){
408  reload();
409  }
410  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
411  iov->updateLastTill(newtillTime);
412  updateIOV( m_iov->dbSession, iov, m_iov->token );
413  }
void reportError(std::string message) const
Definition: IOVEditor.cc:231
void updateIOV(cond::DbSession &dbSess, const boost::shared_ptr< IOVSequence > &data, const std::string &token)
Definition: IOVEditor.cc:38
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147
bool IOVEditor::validTime ( cond::Time_t  time,
cond::TimeType  timetype 
) const
private

Definition at line 284 of file IOVEditor.cc.

References cond::TimeTypeSpecs::beginValue, cond::TimeTypeSpecs::endValue, timetype(), and cond::timeTypeSpecs.

Referenced by append(), bulkAppend(), freeInsert(), insert(), and validTime().

285  {
287 
288  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
Time_t beginValue
Definition: Time.h:45
TimeType timetype() const
Definition: IOVEditor.cc:538
Time_t endValue
Definition: Time.h:46
bool IOVEditor::validTime ( cond::Time_t  time) const
private

Definition at line 290 of file IOVEditor.cc.

References m_iov, and validTime().

290  {
291  return validTime(time,m_iov->data->timeType());
292  }
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:284
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:147

Member Data Documentation

boost::shared_ptr<cond::IOVProxyData> cond::IOVEditor::m_iov
private
bool cond::IOVEditor::m_isLoaded
private