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 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 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 261 of file OraDbSchema.cc.

References cond::persistency::throwException().

261  {
262  throwException( "Erase iovs from ORA database is not supported.",
263  "OraIOVTable::erase" );
264  }
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 213 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().

213  {
214  if(!m_cache.load( tag ) || m_cache.iovSequence().size()==0 ) return false;
216  since = last.since();
217  hash = last.token();
218  return true;
219  }
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 221 of file OraDbSchema.cc.

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

Referenced by getSnapshotSize().

221  {
222  if(!m_cache.load( tag )) return false;
224  return true;
225  }
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::getSnapshotSize ( const std::string &  tag,
const boost::posix_time::ptime &  snapshotTime,
size_t &  size 
)
virtual

Implements cond::persistency::IIOVTable.

Definition at line 227 of file OraDbSchema.cc.

References getSize().

227  {
228  // no (easy) way to do it...
229  return getSize( tag,size );
230  }
bool getSize(const std::string &tag, size_t &size)
Definition: OraDbSchema.cc:221
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 243 of file OraDbSchema.cc.

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

244  {
245  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
246  "OraIOVTable::insertOne");
247  if( m_cache.editor().timetype() != cond::hash ){
248  std::vector<std::pair<cond::Time_t, std::string > > data;
249  data.reserve( iovs.size() );
250  for( auto v : iovs ){
251  data.push_back( std::make_pair( std::get<0>(v), std::get<1>(v) ) );
252  }
253  m_cache.editor().bulkAppend( data );
254  } else {
255  for( auto v: iovs ){
256  insertOne( tag, std::get<0>(v), std::get<1>(v), std::get<2>(v) );
257  }
258  }
259  }
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:232
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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 232 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().

233  {
234  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
235  "OraIOVTable::insertOne");
236  if( m_cache.editor().timetype() != cond::hash ){
237  m_cache.editor().append( since, payloadHash );
238  } else {
239  m_cache.editor().freeInsert( since, payloadHash );
240  }
241  }
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.

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::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