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 ()
 
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 77 of file OraDbSchema.h.

Constructor & Destructor Documentation

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

Definition at line 138 of file OraDbSchema.cc.

138  :
139  m_cache( iovCache ){
140  }
virtual cond::persistency::OraIOVTable::~OraIOVTable ( )
inlinevirtual

Definition at line 80 of file OraDbSchema.h.

80 {}

Member Function Documentation

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

Implements cond::persistency::IIOVTable.

Definition at line 84 of file OraDbSchema.h.

84  {
85  }
bool cond::persistency::OraIOVTable::exists ( )
inlinevirtual

Implements cond::persistency::IIOVTable.

Definition at line 81 of file OraDbSchema.h.

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

Implements cond::persistency::IIOVTable.

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

188  {
189  if(!m_cache.load( tag ) || m_cache.iovSequence().size()==0 ) return false;
191  since = last.since();
192  hash = last.token();
193  return true;
194  }
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 196 of file OraDbSchema.cc.

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

Referenced by getSnapshotSize().

196  {
197  if(!m_cache.load( tag )) return false;
199  return true;
200  }
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 202 of file OraDbSchema.cc.

References getSize().

202  {
203  // no (easy) way to do it...
204  return getSize( tag,size );
205  }
bool getSize(const std::string &tag, size_t &size)
Definition: OraDbSchema.cc:196
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 214 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.

215  {
216  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
217  "OraIOVTable::insertOne");
218  std::vector<std::pair<cond::Time_t, std::string > > data;
219  data.reserve( iovs.size() );
220  for( auto v : iovs ){
221  data.push_back( std::make_pair( std::get<0>(v), std::get<1>(v) ) );
222  }
223  m_cache.editor().bulkAppend( data );
224  }
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 207 of file OraDbSchema.cc.

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

208  {
209  if(!m_cache.load(tag)) throwException("Tag "+tag+" has not been found in the database.",
210  "OraIOVTable::insertOne");
211  m_cache.editor().append( since, payloadHash );
212  }
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 142 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().

142  {
143  if(!m_cache.load( tag )) return 0;
144  if( m_cache.iovSequence().size()>0 ){
145  groups.push_back( m_cache.iovSequence().firstSince() );
146  groups.push_back( m_cache.iovSequence().lastTill() );
147  return true;
148  }
149  return false;
150  }
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 177 of file OraDbSchema.cc.

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

177  {
178  // avoid this! copying the entire iov sequence...
179  if(!m_cache.load( tag )) return 0;
180  size_t ret = 0;
181  for( auto iov : m_cache.iovSequence() ){
182  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
183  ret++;
184  }
185  return ret;
186  }
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 158 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().

159  {
160  if(!m_cache.load( tag )) return 0;
161  cond::IOVRange range = m_cache.iovSequence().range( lowerGroup, upperGroup );
162  size_t ret = 0;
163  for( auto iov : range ){
164  iovs.push_back( std::make_tuple( iov.since(), iov.token() ) );
165  ret++;
166  }
167  return ret;
168  }
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 170 of file OraDbSchema.cc.

References selectLatestByGroup().

172  {
173  // no (easy) way to do it...
174  return selectLatestByGroup( tag, lowerGroup, upperGroup, iovs );
175  }
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:158
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 152 of file OraDbSchema.cc.

References selectGroups().

153  {
154  // no (easy) way to do it...
155  return selectGroups( tag, groups );
156  }
size_t selectGroups(const std::string &tag, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:142

Member Data Documentation

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