8 namespace persistency {
33 std::vector<std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime> >
iovBuffer;
53 const boost::posix_time::ptime& creationTime ):
58 m_data->payloadType = payloadObjectType;
60 m_data->creationTime = creationTime;
108 m_data->changes.insert(
"SynchronizationType");
120 m_data->changes.insert(
"EndOfValidity");
132 m_data->changes.insert(
"Description");
144 m_data->changes.insert(
"LastValidatedTime");
153 boost::posix_time::ptime
now = boost::posix_time::microsec_clock::universal_time();
154 insert( since, payloadHash, now, checkType );
160 m_data->iovBuffer.push_back( std::tie( since, payloadHash, insertionTime ) );
164 bool iovSorter(
const std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime>&
f,
const std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime>&
s ){
165 return std::get<0>(
f) < std::get<0>(s);
172 if( lt.empty() ) lt =
"-";
174 if(
m_data->description.empty() )
throwException(
"A non-empty description string is mandatory.",
"IOVEditor::flush" );
175 if(
m_data->validationMode )
m_session->iovSchema().tagTable().setValidationMode();
178 if(
m_data->creationTime.is_not_a_date_time() )
m_data->creationTime = operationTime;
182 if(
m_session->iovSchema().tagLogTable().exists() )
183 m_session->iovSchema().tagLogTable().insert(
m_data->tag,
m_data->creationTime, cond::getUserName(),cond::getHostName(), cond::getCommand(),
189 m_data->lastValidatedTime, operationTime );
190 if(
m_session->iovSchema().tagLogTable().exists() ){
195 if( i==(
m_data->changes.size()-1) ) action +=
".";
199 m_session->iovSchema().tagLogTable().insert(
m_data->tag, operationTime, cond::getUserName(),cond::getHostName(), cond::getCommand(),
206 if( !
m_data->iovBuffer.empty() ) {
217 boost::posix_time::ptime no_time;
218 m_session->iovSchema().iovTable().getLastIov(
m_data->tag, no_time, last, h );
221 std::stringstream
msg;
222 msg <<
"Can't insert iov since "<<l<<
" on the tag "<<
m_data->tag<<
": last since is "<<last<<
228 for(
auto& iov :
m_data->iovBuffer ){
229 boost::posix_time::ptime& insertionTime = std::get<2>(iov);
230 if( insertionTime.is_not_a_date_time() ) insertionTime = operationTime;
234 std::stringstream
msg;
235 msg <<
m_data->iovBuffer.size() <<
" iov(s) inserted.";
236 if(
m_session->iovSchema().tagLogTable().exists() ){
237 m_session->iovSchema().tagLogTable().insert(
m_data->tag, operationTime, cond::getUserName(), cond::getHostName(), cond::getCommand(),
240 m_data->iovBuffer.clear();
248 return flush( logText, boost::posix_time::microsec_clock::universal_time(),
false );
256 return flush(
std::string(
"-"), boost::posix_time::microsec_clock::universal_time(),
false );
260 return flush( logText, boost::posix_time::microsec_clock::universal_time(), forceInsertion );
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::string synchronizationTypeNames(SynchronizationType type)
void checkTransaction(const std::string &ctx)
cond::Time_t lastValidatedTime
void load(const std::string &tag)
void setDescription(const std::string &description)
std::set< std::string > changes
void setLastValidatedTime(cond::Time_t time)
std::shared_ptr< SessionImpl > m_session
void throwException(const std::string &message, const std::string &methodName)
std::string description() const
unsigned long long Time_t
IOVEditor & operator=(const IOVEditor &rhs)
cond::SynchronizationType synchronizationType() const
cond::Time_t endOfValidity() const
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
cond::Time_t endOfValidity
std::shared_ptr< IOVEditorData > m_data
bool iovSorter(const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &f, const std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > &s)
cond::TimeType timeType() const
boost::posix_time::ptime creationTime
cond::Time_t lastValidatedTime() const
cond::SynchronizationType synchronizationType
std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > iovBuffer
void setEndOfValidity(cond::Time_t validity)
void setSynchronizationType(cond::SynchronizationType synchronizationType)
std::string payloadType() const
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
void throwException(const std::string &message, const std::string &methodName)