13#ifndef ATHENASERVICES_DELAYEDCONDITIONSCLEANERTOOLSVC_H
14#define ATHENASERVICES_DELAYEDCONDITIONSCLEANERTOOLSVC_H
24#include <unordered_map>
30class DelayedConditionsCleanerTask;
58 :
public extends<AthService, IConditionsCleanerSvc>
87 virtual StatusCode
finalize()
override;
96 virtual StatusCode
event (
const EventContext& ctx,
bool allowAsync)
override;
104 virtual StatusCode
condObjAdded (
const EventContext& ctx,
113 virtual StatusCode
printStats()
const override;
120 virtual StatusCode
reset()
override;
214 typedef std::unordered_map<CondContBase*, CondContInfo>
CCInfoMap_t;
232 return m_evt > other.m_evt;
256 std::unique_ptr<DelayedConditionsCleanerSvcProps>
m_props;
Interface for doing garbage collection of conditions objects.
Information that we maintain about each conditions container.
size_t m_removed2plus
Number of times two or more objects were removed.
size_t m_removed1
Number of times exactly 1 object was removed.
size_t m_removed0
Number of times exactly 0 objects were removed.
CondContInfo(CondContBase &cc)
size_t m_nClean
Number of times cleaning was attempted.
CondContBase & m_cc
The conditions container.
size_t m_nRemoved
Total number of objects removed by cleaning.
DelayedConditionsCleanerSvc(const std::string &name, ISvcLocator *svc)
Standard Gaudi constructor.
std::priority_queue< QueueItem > m_work
Priority queue of pending cleaning requests.
size_t m_nEvents
Priority queue statistics.
friend class DelayedConditionsCleanerTask
twoKeys_t getKeys(const Ring &runLBRing, const Ring &TSRing) const
virtual StatusCode condObjAdded(const EventContext &ctx, CondContBase &cc) override
Called after a conditions object has been added.
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Ring m_runlbn
Two ring buffers for recent IOV keys, one for run+LBN and one for timestamp.
std::vector< key_type > m_slotTimestamp
virtual StatusCode event(const EventContext &ctx, bool allowAsync) override
Called at the start of each event.
void scheduleClean(std::vector< CondContInfo * > &&cis, twoKeys_t &&twoKeys, bool allowAsync)
Do cleaning for a set of containers.
std::unique_ptr< DelayedConditionsCleanerSvcProps > m_props
Component properties.
CxxUtils::Ring< key_type > Ring
Ring buffer holding most recent IOV keys of a given type.
CondContBase::key_type key_type
Packed key type.
std::lock_guard< mutex_t > lock_t
std::atomic< int > m_cleanTasks
Number of active asynchronous cleaning tasks.
virtual StatusCode reset() override
Clear the internal state of the service.
std::array< std::vector< key_type >, 2 > twoKeys_t
void cleanContainers(std::vector< CondContInfo * > &&cis, twoKeys_t &&twoKeys)
Clean a set of containers.
CondContBase::KeyType KeyType
Run+LBN or timestamp key?
bool cleanContainer(CondContInfo *ci, const twoKeys_t &keys) const
Clean a single container.
std::mutex mutex_t
Serialize access to m_ccinfo and m_work.
std::vector< key_type > m_slotLBN
IOV keys currently in use for each slot.
virtual StatusCode finalize() override
Standard Gaudi finalize method.
virtual StatusCode printStats() const override
Print some statistics about the garbage collection.
~DelayedConditionsCleanerSvc()
Standard destructor.
std::unordered_map< CondContBase *, CondContInfo > CCInfoMap_t
Map of information, indexed by the conditions container.
Base class for all conditions containers.
KeyType
Type of key used for this container.
uint64_t key_type
Type used to store an IOV time internally.
A very simple ring buffer.
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
bool operator<(const QueueItem &other) const
QueueItem(EventContext::ContextEvt_t evt, CondContInfo &ci)
EventContext::ContextEvt_t m_evt