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

154  :
155  m_cache( iovCache ){
156  }
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 242 of file OraDbSchema.cc.

References cond::persistency::throwException().

242  {
243  throwException( "Erase iovs from ORA database is not supported.",
244  "OraIOVTable::erase" );
245  }
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 204 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().

204  {
205  if(!m_cache.load( tag ) || m_cache.iovSequence().size()==0 ) return false;
207  since = last.since();
208  hash = last.token();
209  return true;
210  }
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 212 of file OraDbSchema.cc.

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

Referenced by getSnapshotSize().

212  {
213  if(!m_cache.load( tag )) return false;
215  return true;
216  }
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 218 of file OraDbSchema.cc.

References getSize().

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

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

231  {
232  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
233  "OraIOVTable::insertOne");
234  std::vector<std::pair<cond::Time_t, std::string > > data;
235  data.reserve( iovs.size() );
236  for( auto v : iovs ){
237  data.push_back( std::make_pair( std::get<0>(v), std::get<1>(v) ) );
238  }
239  m_cache.editor().bulkAppend( data );
240  }
cond::IOVEditor editor()
Definition: OraDbSchema.cc:29
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
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 223 of file OraDbSchema.cc.

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

224  {
225  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
226  "OraIOVTable::insertOne");
227  m_cache.editor().append( since, payloadHash );
228  }
cond::IOVEditor editor()
Definition: OraDbSchema.cc:29
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 158 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().

158  {
159  if(!m_cache.load( tag )) return 0;
160  if( m_cache.iovSequence().size()>0 ){
161  groups.push_back( m_cache.iovSequence().firstSince() );
162  groups.push_back( m_cache.iovSequence().lastTill() );
163  return true;
164  }
165  return false;
166  }
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 193 of file OraDbSchema.cc.

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

193  {
194  // avoid this! copying the entire iov sequence...
195  if(!m_cache.load( tag )) return 0;
196  size_t ret = 0;
197  for( auto iov : m_cache.iovSequence() ){
198  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
199  ret++;
200  }
201  return ret;
202  }
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 174 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().

175  {
176  if(!m_cache.load( tag )) return 0;
177  cond::IOVRange range = m_cache.iovSequence().range( lowerGroup, upperGroup );
178  size_t ret = 0;
179  for( auto iov : range ){
180  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
181  ret++;
182  }
183  return ret;
184  }
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 186 of file OraDbSchema.cc.

References selectLatestByGroup().

188  {
189  // no (easy) way to do it...
190  return selectLatestByGroup( tag, lowerGroup, upperGroup, iovs );
191  }
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:174
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 168 of file OraDbSchema.cc.

References selectGroups().

169  {
170  // no (easy) way to do it...
171  return selectGroups( tag, groups );
172  }
size_t selectGroups(const std::string &tag, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:158

Member Data Documentation

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