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 (cond::DbSession &dbSess)
 
 IOVEditor (cond::DbSession &dbSess, const std::string &token)
 
void load (const std::string &token)
 
cond::IOVProxy proxy ()
 
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 ( cond::DbSession dbSess)
explicit

Definition at line 170 of file IOVEditor.cc.

170  :
171  m_isLoaded(false),
172  m_iov( new IOVProxyData( dbSess ) ){
173  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
IOVEditor::IOVEditor ( cond::DbSession dbSess,
const std::string &  token 
)

Definition at line 175 of file IOVEditor.cc.

176  :
177  m_isLoaded(false),
178  m_iov( new IOVProxyData( dbSess, token )){
179  }
std::string const & token() const
Definition: IOVEditor.cc:526
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
IOVEditor::~IOVEditor ( )

Destructor.

Definition at line 168 of file IOVEditor.cc.

168 {}

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 400 of file IOVEditor.cc.

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

Referenced by Vispa.Views.PropertyView.PropertyView::addProperty(), cond::service::PoolDBOutputService::appendIOV(), cond::service::PoolDBOutputService::createNewIOV(), cond::AlignSplitIOV::execute(), python.seqvaluedict.seqdict::push(), and TestFunct::WriteWithIOV().

401  {
402  if( m_iov->token.empty() ) {
403  reportError("cond::IOVEditor::appendIOV cannot append to non-existing IOV index");
404  }
405 
406  if( !m_isLoaded ){
407  reload();
408  }
409  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
410 
411  if(!validTime(sinceTime))
412  reportError("cond::IOVEditor::append time not in global range",sinceTime);
413 
414  if( !iov->iovs().empty() ){
415  //range check in case
416  cond::Time_t lastValidSince=iov->iovs().back().sinceTime();
417  if( sinceTime<= lastValidSince){
418  std::ostringstream errStr;
419  errStr << "IOVEditor::append Error: trying to append a since time " << lastValidSince
420  << " which is not larger than last since";
421  reportError(errStr.str(), sinceTime);
422  }
423  }
424 
425  // does it make sense? (in case of mixed till and since insertions...)
426  if (iov->lastTill()<=sinceTime) iov->updateLastTill( timeTypeSpecs[iov->timeType()].endValue );
427  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
428  unsigned int ret = iov->add(sinceTime,payloadToken, payloadClassName );
429  updateIOV( m_iov->dbSession, iov, m_iov->token );
430  return ret;
431  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:268
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:140
void IOVEditor::bulkAppend ( std::vector< std::pair< cond::Time_t, std::string > > &  values)

Bulk append of iov chunck.

Definition at line 305 of file IOVEditor.cc.

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

305  {
306  if (values.empty()) return;
307  if( !m_isLoaded ){
308  reload();
309  }
310  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
311  cond::Time_t firstTime = values.front().first;
312  cond::Time_t lastTime = values.back().first;
313  if(!validTime(firstTime))
314  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
315 
316  if(!validTime(lastTime))
317  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
318 
319  if(lastTime>= iov->lastTill() ||
320  ( !iov->iovs().empty() && firstTime<=iov->iovs().back().sinceTime())
321  )
322  reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
323 
324  for(std::vector< std::pair<cond::Time_t,std::string> >::const_iterator it=values.begin(); it!=values.end(); ++it){
325  std::string payloadClassName = m_iov->dbSession.classNameForItem( it->second );
326  iov->add(it->first,it->second,payloadClassName );
327  }
328  updateIOV( m_iov->dbSession, iov, m_iov->token );
329  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:268
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:18
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
void IOVEditor::bulkAppend ( std::vector< cond::IOVElement > &  values)

Definition at line 332 of file IOVEditor.cc.

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

332  {
333  if (values.empty()) return;
334  if( !m_isLoaded ){
335  reload();
336  }
337  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
338  cond::Time_t firstTime = values.front().sinceTime();
339  cond::Time_t lastTime = values.back().sinceTime();
340  if(!validTime(firstTime))
341  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
342 
343  if(!validTime(lastTime))
344  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
345 
346  if(lastTime>=iov->lastTill() ||
347  ( !iov->iovs().empty() && firstTime<=iov->iovs().back().sinceTime())
348  ) reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
349 
350  for(std::vector< cond::IOVElement >::const_iterator it=values.begin(); it!=values.end(); ++it){
351  std::string payloadClassName = m_iov->dbSession.classNameForItem( it->token() );
352  iov->add(it->sinceTime(),it->token(),payloadClassName );
353  }
354 
355  updateIOV( m_iov->dbSession, iov, m_iov->token );
356  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:268
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:18
tuple iov
Definition: o2o.py:307
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
std::string IOVEditor::create ( cond::TimeType  timetype)

Definition at line 244 of file IOVEditor.cc.

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

Referenced by cond::service::PoolDBOutputService::createNewIOV(), cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), and TestFunct::WriteWithIOV().

244  {
245  m_iov->data.reset( new cond::IOVSequence(timetype) );
246  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
247  m_isLoaded=true;
248  return m_iov->token;
249  }
TimeType timetype() const
Definition: IOVEditor.cc:522
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:140
std::string IOVEditor::create ( cond::TimeType  timetype,
cond::Time_t  lastTill,
const std::string &  metadata 
)

Definition at line 251 of file IOVEditor.cc.

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

253  {
254  m_iov->data.reset( new cond::IOVSequence((int)timetype,lastTill, metadata) );
255  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
256  m_isLoaded=true;
257  return m_iov->token;
258  }
TimeType timetype() const
Definition: IOVEditor.cc:522
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:140
std::string IOVEditor::create ( cond::TimeType  timetype,
cond::Time_t  lastTill 
)

Definition at line 261 of file IOVEditor.cc.

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

261  {
262  m_iov->data.reset( new cond::IOVSequence((int)timetype,lastTill, std::string(" ")) );
263  m_iov->token = insertIOV( m_iov->dbSession, m_iov->data );
264  m_isLoaded=true;
265  return m_iov->token;
266  }
TimeType timetype() const
Definition: IOVEditor.cc:522
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:140
bool IOVEditor::createIOVContainerIfNecessary ( )

Definition at line 233 of file IOVEditor.cc.

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

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

233  {
234  bool ret = false;
235  cond::IOVSchemaUtility schemaUtil( m_iov->dbSession );
236  if( !schemaUtil.existsIOVContainer() ){
237  schemaUtil.createIOVContainer();
238  ret = true;
239  }
240  return ret;
241  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
void IOVEditor::debugInfo ( std::ostream &  co) const
private

Definition at line 192 of file IOVEditor.cc.

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

Referenced by reportError().

192  {
193  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
194  co << "IOVEditor: ";
195  co << "db " << m_iov->dbSession.connectionString();
196  if(m_iov->token.empty()) {
197  co << " no token"; return;
198  }
199  if (!m_iov->data.get() ) {
200  co << " no iov for token " << m_iov->token;
201  return;
202  }
203  co << " iov token " << m_iov->token;
204  co << "\nStamp: " << iov->comment()
205  << "; time " << iov->timestamp()
206  << "; revision " << iov->revision();
207  co <<". TimeType " << cond::timeTypeSpecs[ iov->timeType()].name;
208  if( iov->iovs().empty() )
209  co << ". empty";
210  else
211  co << ". size " << iov->iovs().size()
212  << "; last since " << iov->iovs().back().sinceTime();
213  }
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:140
void IOVEditor::deleteEntries ( bool  withPayload = false)

Definition at line 488 of file IOVEditor.cc.

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

488  {
489  if( m_iov->token.empty() ) reportError("cond::IOVEditor::deleteEntries cannot delete to non-existing IOV sequence");
490  if( !m_isLoaded ){
491  reload();
492  }
493  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
494  if(withPayload){
495  std::string tokenStr;
496  IOVSequence::const_iterator payloadIt;
497  IOVSequence::const_iterator payloadItEnd=iov->piovs().end();
498  for(payloadIt=iov->piovs().begin();payloadIt!=payloadItEnd;++payloadIt){
499  tokenStr=payloadIt->token();
500  m_iov->dbSession.deleteObject( tokenStr );
501  }
502  }
503  m_iov->dbSession.deleteObject( m_iov->token );
504  iov->piovs().clear();
505  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:140
void IOVEditor::editMetadata ( std::string const &  metadata,
bool  append = false 
)

edit metadata

Definition at line 369 of file IOVEditor.cc.

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

370  {
371  if( !m_isLoaded ){
372  reload();
373  }
374  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
375  iov->updateMetadata( metadata, append);
376  updateIOV( m_iov->dbSession, iov, m_iov->token );
377  }
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:400
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
unsigned int IOVEditor::freeInsert ( cond::Time_t  sinceTime,
const std::string &  payloadToken 
)

insert a payload with known since in any position

Definition at line 435 of file IOVEditor.cc.

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

Referenced by cond::service::PoolDBOutputService::appendIOV().

436  {
437  if( m_iov->token.empty() ) {
438  reportError("cond::IOVEditor::freeInsert cannot append to non-existing IOV index");
439  }
440 
441  if( !m_isLoaded ){
442  reload();
443  }
444  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
445 
446  // if( m_iov->data->iov.empty() ) reportError("cond::IOVEditor::freeInsert cannot insert to empty IOV index");
447 
448 
449  if(!validTime(sinceTime))
450  reportError("cond::IOVEditor::freeInsert time not in global range",sinceTime);
451 
452 
453  // we do not support multiple iov with identical since...
454  if (m_iov->data->exist(sinceTime))
455  reportError("cond::IOVEditor::freeInsert sinceTime already existing",sinceTime);
456 
457 
458 
459  // does it make sense? (in case of mixed till and since insertions...)
460  if (iov->lastTill()<sinceTime) iov->updateLastTill( timeTypeSpecs[iov->timeType()].endValue );
461  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
462  unsigned int ret = iov->add(sinceTime,payloadToken, payloadClassName );
463  updateIOV( m_iov->dbSession, iov, m_iov->token );
464  return ret;
465  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:268
tuple iov
Definition: o2o.py:307
Time_t endValue
Definition: Time.h:46
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
size_t IOVEditor::import ( cond::DbSession sourceSess,
const std::string &  sourceIovToken 
)

Definition at line 507 of file IOVEditor.cc.

References importIterator().

508  {
509  boost::shared_ptr<IOVImportIterator> importer = importIterator();
510  importer->setUp( sourceSess, sourceIovToken );
511  return importer->importAll();
512  }
boost::shared_ptr< IOVImportIterator > importIterator()
Definition: IOVEditor.cc:515
boost::shared_ptr< IOVImportIterator > IOVEditor::importIterator ( )

Definition at line 515 of file IOVEditor.cc.

References m_iov, m_isLoaded, and reload().

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

515  {
516  if( !m_isLoaded ){
517  reload();
518  }
519  return boost::shared_ptr<IOVImportIterator>( new IOVImportIterator( m_iov ));
520  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
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 281 of file IOVEditor.cc.

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

Referenced by BeautifulSoup.PageElement::append().

282  {
283  if( !m_isLoaded ){
284  reload();
285  }
286  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
287  if( iov->iovs().empty() )
288  reportError("cond::IOVEditor::insert cannot inser into empty IOV sequence",tillTime);
289 
290  if(!validTime(tillTime))
291  reportError("cond::IOVEditor::insert time not in global range",tillTime);
292 
293  if(tillTime<=iov->lastTill() )
294  reportError("cond::IOVEditor::insert IOV not in range",tillTime);
295 
296  cond::Time_t newSince=iov->lastTill()+1;
297  std::string payloadClassName = m_iov->dbSession.classNameForItem( payloadToken );
298  unsigned int ret = iov->add(newSince, payloadToken, payloadClassName);
299  iov->updateLastTill(tillTime);
300  updateIOV( m_iov->dbSession, iov, m_iov->token );
301  return ret;
302  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:268
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:140
void IOVEditor::load ( const std::string &  token)

Definition at line 186 of file IOVEditor.cc.

References m_iov, m_isLoaded, and token().

Referenced by cond::ExportIOVUtilities::execute(), MatrixToProcess.MatrixToProcess::getProcess(), and MatrixToProcess.MatrixToProcess::listAll().

186  {
187  m_iov->token = token;
188  m_iov->refresh();
189  m_isLoaded = true;
190  }
std::string const & token() const
Definition: IOVEditor.cc:526
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
IOVProxy IOVEditor::proxy ( )

Definition at line 530 of file IOVEditor.cc.

References m_iov.

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

530  {
531  return IOVProxy( m_iov );
532  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
void IOVEditor::reload ( )

Definition at line 181 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().

181  {
182  m_iov->refresh();
183  m_isLoaded = true;
184  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
void IOVEditor::reportError ( std::string  message) const
private

Definition at line 215 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().

215  {
216  std::ostringstream out;
217  out << "Error in ";
218  debugInfo(out);
219  out << "\n" << message;
220  throw cond::Exception(out.str());
221  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:192
tuple out
Definition: dbtoconf.py:99
void IOVEditor::reportError ( std::string  message,
cond::Time_t  time 
) const
private

Definition at line 223 of file IOVEditor.cc.

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

224  {
225  std::ostringstream out;
226  out << "Error in";
227  debugInfo(out);
228  out << "\n" << message << " for time: " << time;
229  throw cond::Exception(out.str());
230  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:192
tuple out
Definition: dbtoconf.py:99
void IOVEditor::setScope ( cond::IOVSequence::ScopeType  scope)

set the scope

Definition at line 379 of file IOVEditor.cc.

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

Referenced by cond::service::PoolDBOutputService::createNewIOV(), and cond::ExportIOVUtilities::execute().

379  {
380  if( !m_isLoaded ){
381  reload();
382  }
383  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
384  iov->setScope( scope );
385  updateIOV( m_iov->dbSession, iov, m_iov->token );
386  }
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:140
void IOVEditor::stamp ( std::string const &  icomment,
bool  append = false 
)

Definition at line 359 of file IOVEditor.cc.

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

Referenced by cond::service::PoolDBOutputService::appendIOV(), cond::service::PoolDBOutputService::closeIOV(), cond::service::PoolDBOutputService::createNewIOV(), and cond::AlignSplitIOV::execute().

360  {
361  if( !m_isLoaded ){
362  reload();
363  }
364  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
365  iov->stamp(icomment, append);
366  updateIOV( m_iov->dbSession, iov, m_iov->token );
367  }
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:400
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
TimeType IOVEditor::timetype ( ) const

Definition at line 522 of file IOVEditor.cc.

References m_iov.

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

522  {
523  return m_iov->data->timeType();
524  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
std::string const & IOVEditor::token ( ) const

Definition at line 526 of file IOVEditor.cc.

References m_iov.

Referenced by cond::service::PoolDBOutputService::createNewIOV(), cond::AlignSplitIOV::execute(), load(), and TestFunct::WriteWithIOV().

526  {
527  return m_iov->token;
528  }
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140
unsigned int IOVEditor::truncate ( bool  withPayload = false)

Definition at line 469 of file IOVEditor.cc.

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

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

469  {
470  if( m_iov->token.empty() ) reportError("cond::IOVEditor::truncate cannot delete to non-existing IOV sequence");
471  if( !m_isLoaded ){
472  reload();
473  }
474  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
475  if (iov->piovs().empty()) return 0;
476  if(withPayload){
477  std::string tokenStr = iov->piovs().back().token();
478  m_iov->dbSession.deleteObject( tokenStr );
479  }
480  unsigned int ret = iov->truncate();
481  updateIOV( m_iov->dbSession, iov, m_iov->token );
482  return ret;
483 
484  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:140
void IOVEditor::updateClosure ( cond::Time_t  newtillTime)

Update the closure of the iov sequence.

Definition at line 389 of file IOVEditor.cc.

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

Referenced by cond::service::PoolDBOutputService::appendIOV(), and cond::service::PoolDBOutputService::closeIOV().

389  {
390  if( m_iov->token.empty() ) reportError("cond::IOVEditor::updateClosure cannot change non-existing IOV index");
391  if( !m_isLoaded ){
392  reload();
393  }
394  boost::shared_ptr<IOVSequence>& iov = m_iov->data;
395  iov->updateLastTill(newtillTime);
396  updateIOV( m_iov->dbSession, iov, m_iov->token );
397  }
void reportError(std::string message) const
Definition: IOVEditor.cc:215
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:140
bool IOVEditor::validTime ( cond::Time_t  time,
cond::TimeType  timetype 
) const
private

Definition at line 268 of file IOVEditor.cc.

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

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

269  {
271 
272  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
Time_t beginValue
Definition: Time.h:45
TimeType timetype() const
Definition: IOVEditor.cc:522
Time_t endValue
Definition: Time.h:46
bool IOVEditor::validTime ( cond::Time_t  time) const
private

Definition at line 274 of file IOVEditor.cc.

References m_iov, and validTime().

274  {
275  return validTime(time,m_iov->data->timeType());
276  }
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:268
boost::shared_ptr< cond::IOVProxyData > m_iov
Definition: IOVEditor.h:140

Member Data Documentation

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