Belle II Software light-2406-ragdoll
ProcessedEventsBackupList Class Reference

List-like structure for storing and retaining event backups. More...

#include <ProcessedEventsBackupList.h>

Collaboration diagram for ProcessedEventsBackupList:

Public Member Functions

void storeEvent (std::unique_ptr< EvtMessage > evtMsg, const StoreObjPtr< EventMetaData > &evtMetaData, const unsigned int workerId)
 Add a new event backup with the given information. Takes ownership of the evt message.
 
void removeEvent (const EventMetaData &evtMetaData)
 Remove all backups with the given event meta data (on confirmation)
 
int checkForTimeout (const Duration &timeout) const
 Check the items for timeout. Returns -1 if no timeout happened and the worker id, if it did.
 
template<class AZMQClient >
void sendWorkerBackupEvents (unsigned int worker, const AZMQClient &socket)
 Send all backups of a given worker directly to the multicast and delete them.
 
unsigned int size () const
 Check the size.
 

Private Types

using Duration = std::chrono::milliseconds
 Short for the class of a duration (always measured in milliseconds)
 

Private Attributes

std::vector< ProcessedEventBackupm_evtBackupVector
 The vector where the event backups are stored.
 

Detailed Description

List-like structure for storing and retaining event backups.

Definition at line 24 of file ProcessedEventsBackupList.h.

Member Typedef Documentation

◆ Duration

using Duration = std::chrono::milliseconds
private

Short for the class of a duration (always measured in milliseconds)

Definition at line 26 of file ProcessedEventsBackupList.h.

Member Function Documentation

◆ checkForTimeout()

int checkForTimeout ( const Duration timeout) const

Check the items for timeout. Returns -1 if no timeout happened and the worker id, if it did.

Definition at line 31 of file ProcessedEventsBackupList.cc.

32{
33 if (m_evtBackupVector.empty()) {
34 return -1;
35 }
36 if (std::chrono::system_clock::now() - m_evtBackupVector[0].getTimestamp() > timeout) {
37 return m_evtBackupVector[0].getWorkerId();
38 } else {
39 return -1;
40 }
41}
std::vector< ProcessedEventBackup > m_evtBackupVector
The vector where the event backups are stored.

◆ removeEvent()

void removeEvent ( const EventMetaData evtMetaData)

Remove all backups with the given event meta data (on confirmation)

Definition at line 19 of file ProcessedEventsBackupList.cc.

20{
21 const auto oldSize = m_evtBackupVector.size();
22
23 m_evtBackupVector.erase(std::remove(m_evtBackupVector.begin(), m_evtBackupVector.end(), evtMetaData),
24 m_evtBackupVector.end());
25
26 if (oldSize == m_evtBackupVector.size()) {
27 B2WARNING("Event: " << evtMetaData.getEvent() << ", no matching event backup found in backup list");
28 }
29}
unsigned int getEvent() const
Event Getter.

◆ size()

unsigned int size ( ) const

Check the size.

Definition at line 43 of file ProcessedEventsBackupList.cc.

44{
45 return m_evtBackupVector.size();
46}

◆ storeEvent()

void storeEvent ( std::unique_ptr< EvtMessage evtMsg,
const StoreObjPtr< EventMetaData > &  evtMetaData,
const unsigned int  workerId 
)

Add a new event backup with the given information. Takes ownership of the evt message.

Definition at line 12 of file ProcessedEventsBackupList.cc.

14{
15 EventMetaData eventMetaData(evtMetaData->getEvent(), evtMetaData->getRun(), evtMetaData->getExperiment());
16 m_evtBackupVector.emplace_back(std::move(evtMsg), eventMetaData, workerId);
17}
Store event, run, and experiment numbers.
Definition: EventMetaData.h:33

Member Data Documentation

◆ m_evtBackupVector

std::vector<ProcessedEventBackup> m_evtBackupVector
private

The vector where the event backups are stored.

Definition at line 47 of file ProcessedEventsBackupList.h.


The documentation for this class was generated from the following files: