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 Attributes
cond::persistency::OraIOVTable Class Reference

#include <OraDbSchema.h>

Inheritance diagram for cond::persistency::OraIOVTable:
cond::persistency::IIOVTable

Public Member Functions

void create ()
 
void erase (const std::string &tag)
 
bool exists ()
 
bool getLastIov (const std::string &tag, cond::Time_t &since, cond::Hash &hash)
 
bool getSize (const std::string &tag, size_t &size)
 
bool getSnapshotLastIov (const std::string &tag, const boost::posix_time::ptime &snapshotTime, cond::Time_t &since, cond::Hash &hash)
 
bool getSnapshotSize (const std::string &tag, const boost::posix_time::ptime &snapshotTime, size_t &size)
 
void insertMany (const std::string &tag, const std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > &iovs)
 
void insertOne (const std::string &tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime &insertTime)
 
 OraIOVTable (IOVCache &cache)
 
size_t selectGroups (const std::string &tag, std::vector< cond::Time_t > &groups)
 
size_t selectLatest (const std::string &tag, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
 
size_t selectLatestByGroup (const std::string &tag, cond::Time_t lowerGroup, cond::Time_t upperGroup, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
 
size_t selectSnapshot (const std::string &tag, const boost::posix_time::ptime &snapshotTime, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
 
size_t selectSnapshotByGroup (const std::string &tag, cond::Time_t lowerGroup, cond::Time_t upperGroup, const boost::posix_time::ptime &snapshotTime, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
 
size_t selectSnapshotGroups (const std::string &tag, const boost::posix_time::ptime &snapshotTime, std::vector< cond::Time_t > &groups)
 
virtual ~OraIOVTable ()
 
- Public Member Functions inherited from cond::persistency::IIOVTable
virtual ~IIOVTable ()
 

Private Attributes

IOVCachem_cache
 

Detailed Description

Definition at line 85 of file OraDbSchema.h.

Constructor & Destructor Documentation

cond::persistency::OraIOVTable::OraIOVTable ( IOVCache cache)
explicit

Definition at line 163 of file OraDbSchema.cc.

163  :
164  m_cache( iovCache ){
165  }
virtual cond::persistency::OraIOVTable::~OraIOVTable ( )
inlinevirtual

Definition at line 88 of file OraDbSchema.h.

88 {}

Member Function Documentation

void cond::persistency::OraIOVTable::create ( )
inlinevirtual

Implements cond::persistency::IIOVTable.

Definition at line 92 of file OraDbSchema.h.

92  {
93  }
void cond::persistency::OraIOVTable::erase ( const std::string &  tag)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 273 of file OraDbSchema.cc.

References cond::persistency::throwException().

273  {
274  throwException( "Erase iovs from ORA database is not supported.",
275  "OraIOVTable::erase" );
276  }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
bool cond::persistency::OraIOVTable::exists ( )
inlinevirtual

Implements cond::persistency::IIOVTable.

Definition at line 89 of file OraDbSchema.h.

89  {
90  return true;
91  }
bool cond::persistency::OraIOVTable::getLastIov ( const std::string &  tag,
cond::Time_t since,
cond::Hash hash 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 219 of file OraDbSchema.cc.

References cond::IOVProxy::end(), cond::persistency::IOVCache::iovSequence(), prof2calltree::last, cond::persistency::IOVCache::load(), m_cache, cond::IOVElementProxy::since(), cond::IOVProxy::size(), and cond::IOVElementProxy::token().

Referenced by getSnapshotLastIov().

219  {
220  if(!m_cache.load( tag ) || m_cache.iovSequence().size()==0 ) return false;
222  since = last.since();
223  hash = last.token();
224  return true;
225  }
const_iterator end() const
Definition: IOVProxy.h:193
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
std::string const & token() const
Definition: IOVProxy.h:75
int size() const
Definition: IOVProxy.cc:272
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
cond::Time_t since() const
Definition: IOVProxy.h:67
bool cond::persistency::OraIOVTable::getSize ( const std::string &  tag,
size_t &  size 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 233 of file OraDbSchema.cc.

References cond::persistency::IOVCache::iovSequence(), cond::persistency::IOVCache::load(), m_cache, and cond::IOVProxy::size().

Referenced by getSnapshotSize().

233  {
234  if(!m_cache.load( tag )) return false;
236  return true;
237  }
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
int size() const
Definition: IOVProxy.cc:272
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
tuple size
Write out results.
bool cond::persistency::OraIOVTable::getSnapshotLastIov ( const std::string &  tag,
const boost::posix_time::ptime &  snapshotTime,
cond::Time_t since,
cond::Hash hash 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 227 of file OraDbSchema.cc.

References getLastIov().

228  {
229  // no (easy) way to do it...
230  return getLastIov( tag, since, hash );
231  }
bool getLastIov(const std::string &tag, cond::Time_t &since, cond::Hash &hash)
Definition: OraDbSchema.cc:219
bool cond::persistency::OraIOVTable::getSnapshotSize ( const std::string &  tag,
const boost::posix_time::ptime &  snapshotTime,
size_t &  size 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 239 of file OraDbSchema.cc.

References getSize().

239  {
240  // no (easy) way to do it...
241  return getSize( tag,size );
242  }
bool getSize(const std::string &tag, size_t &size)
Definition: OraDbSchema.cc:233
tuple size
Write out results.
void cond::persistency::OraIOVTable::insertMany ( const std::string &  tag,
const std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > &  iovs 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 255 of file OraDbSchema.cc.

References cond::IOVEditor::bulkAppend(), AlCaHLTBitMon_QueryRunRegistry::data, cond::persistency::IOVCache::editor(), cond::hash, insertOne(), cond::persistency::IOVCache::load(), m_cache, cond::persistency::throwException(), cond::IOVEditor::timetype(), and findQualityFiles::v.

256  {
257  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
258  "OraIOVTable::insertOne");
259  if( m_cache.editor().timetype() != cond::hash ){
260  std::vector<std::pair<cond::Time_t, std::string > > data;
261  data.reserve( iovs.size() );
262  for( auto v : iovs ){
263  data.push_back( std::make_pair( std::get<0>(v), std::get<1>(v) ) );
264  }
265  m_cache.editor().bulkAppend( data );
266  } else {
267  for( auto v: iovs ){
268  insertOne( tag, std::get<0>(v), std::get<1>(v), std::get<2>(v) );
269  }
270  }
271  }
cond::IOVEditor editor()
Definition: OraDbSchema.cc:29
TimeType timetype() const
Definition: IOVEditor.cc:538
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
void insertOne(const std::string &tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime &insertTime)
Definition: OraDbSchema.cc:244
void bulkAppend(std::vector< std::pair< cond::Time_t, std::string > > &values)
Bulk append of iov chunck.
Definition: IOVEditor.cc:321
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
void cond::persistency::OraIOVTable::insertOne ( const std::string &  tag,
cond::Time_t  since,
cond::Hash  payloadHash,
const boost::posix_time::ptime &  insertTime 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 244 of file OraDbSchema.cc.

References cond::IOVEditor::append(), cond::persistency::IOVCache::editor(), cond::IOVEditor::freeInsert(), cond::hash, cond::persistency::IOVCache::load(), m_cache, cond::persistency::throwException(), and cond::IOVEditor::timetype().

Referenced by insertMany().

245  {
246  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
247  "OraIOVTable::insertOne");
248  if( m_cache.editor().timetype() != cond::hash ){
249  m_cache.editor().append( since, payloadHash );
250  } else {
251  m_cache.editor().freeInsert( since, payloadHash );
252  }
253  }
cond::IOVEditor editor()
Definition: OraDbSchema.cc:29
unsigned int freeInsert(cond::Time_t sinceTime, const std::string &payloadToken)
insert a payload with known since in any position
Definition: IOVEditor.cc:451
TimeType timetype() const
Definition: IOVEditor.cc:538
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
Definition: IOVEditor.cc:416
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
size_t cond::persistency::OraIOVTable::selectGroups ( const std::string &  tag,
std::vector< cond::Time_t > &  groups 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 167 of file OraDbSchema.cc.

References cond::IOVProxy::firstSince(), cond::persistency::IOVCache::iovSequence(), cond::IOVProxy::lastTill(), cond::persistency::IOVCache::load(), m_cache, and cond::IOVProxy::size().

Referenced by selectSnapshotGroups().

167  {
168  if(!m_cache.load( tag )) return 0;
169  if( m_cache.iovSequence().size()>0 ){
170  groups.push_back( m_cache.iovSequence().firstSince() );
171  groups.push_back( m_cache.iovSequence().lastTill() );
172  return true;
173  }
174  return false;
175  }
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
cond::Time_t lastTill() const
Definition: IOVProxy.cc:289
int size() const
Definition: IOVProxy.cc:272
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
cond::Time_t firstSince() const
Definition: IOVProxy.cc:285
size_t cond::persistency::OraIOVTable::selectLatest ( const std::string &  tag,
std::vector< std::tuple< cond::Time_t, cond::Hash > > &  iovs 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 202 of file OraDbSchema.cc.

References o2o::iov, cond::persistency::IOVCache::iovSequence(), cond::persistency::IOVCache::load(), m_cache, and run_regression::ret.

Referenced by selectSnapshot().

202  {
203  // avoid this! copying the entire iov sequence...
204  if(!m_cache.load( tag )) return 0;
205  size_t ret = 0;
206  for( auto iov : m_cache.iovSequence() ){
207  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
208  ret++;
209  }
210  return ret;
211  }
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
tuple iov
Definition: o2o.py:307
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
size_t cond::persistency::OraIOVTable::selectLatestByGroup ( const std::string &  tag,
cond::Time_t  lowerGroup,
cond::Time_t  upperGroup,
std::vector< std::tuple< cond::Time_t, cond::Hash > > &  iovs 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 183 of file OraDbSchema.cc.

References o2o::iov, cond::persistency::IOVCache::iovSequence(), cond::persistency::IOVCache::load(), m_cache, cond::IOVProxy::range(), and run_regression::ret.

Referenced by selectSnapshotByGroup().

184  {
185  if(!m_cache.load( tag )) return 0;
186  cond::IOVRange range = m_cache.iovSequence().range( lowerGroup, upperGroup );
187  size_t ret = 0;
188  for( auto iov : range ){
189  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
190  ret++;
191  }
192  return ret;
193  }
IOVRange range(cond::Time_t since, cond::Time_t till) const
Definition: IOVProxy.cc:239
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
tuple iov
Definition: o2o.py:307
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
size_t cond::persistency::OraIOVTable::selectSnapshot ( const std::string &  tag,
const boost::posix_time::ptime &  snapshotTime,
std::vector< std::tuple< cond::Time_t, cond::Hash > > &  iovs 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 213 of file OraDbSchema.cc.

References selectLatest().

214  {
215  // no (easy) way to do it...
216  return selectLatest( tag, iovs );
217  }
size_t selectLatest(const std::string &tag, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:202
size_t cond::persistency::OraIOVTable::selectSnapshotByGroup ( const std::string &  tag,
cond::Time_t  lowerGroup,
cond::Time_t  upperGroup,
const boost::posix_time::ptime &  snapshotTime,
std::vector< std::tuple< cond::Time_t, cond::Hash > > &  iovs 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 195 of file OraDbSchema.cc.

References selectLatestByGroup().

197  {
198  // no (easy) way to do it...
199  return selectLatestByGroup( tag, lowerGroup, upperGroup, iovs );
200  }
size_t selectLatestByGroup(const std::string &tag, cond::Time_t lowerGroup, cond::Time_t upperGroup, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:183
size_t cond::persistency::OraIOVTable::selectSnapshotGroups ( const std::string &  tag,
const boost::posix_time::ptime &  snapshotTime,
std::vector< cond::Time_t > &  groups 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 177 of file OraDbSchema.cc.

References selectGroups().

178  {
179  // no (easy) way to do it...
180  return selectGroups( tag, groups );
181  }
size_t selectGroups(const std::string &tag, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:167

Member Data Documentation

IOVCache& cond::persistency::OraIOVTable::m_cache
private