Belle II Software light-2406-ragdoll
|
Stream/restore DataStore objects to/from EvtMessage. More...
#include <DataStoreStreamer.h>
Public Member Functions | |
DataStoreStreamer (int complevel=0, bool handleMergeable=true, int maxthread=0) | |
Constructor. | |
DataStoreStreamer (const DataStoreStreamer &)=delete | |
No copying. | |
DataStoreStreamer & | operator= (const DataStoreStreamer &)=delete |
No assignment. | |
~DataStoreStreamer () | |
destructor | |
EvtMessage * | streamDataStore (bool addPersistentDurability, bool streamTransientObjects=false) |
Store DataStore objects in EvtMessage. | |
int | restoreDataStore (EvtMessage *msg) |
Restore DataStore objects from EvtMessage. | |
void | setStreamingObjects (const std::vector< std::string > &list) |
Set names of objects to be streamed/destreamed. | |
int | queueEvtMessage (char *msg) |
Queue EvtMessage for destreaming. | |
void * | decodeEvtMessage (int id) |
Decode EvtMessage and store objects in temporary buffer. | |
int | restoreDataStoreAsync () |
Restore objects in DataStore from temporary buffer. | |
void | setMaxThreads (int) |
maximum number of threads. | |
int | getMaxThreads () |
maximum number of threads. | |
void | setDecoderStatus (int) |
Ask Itoh-san about this. | |
int | getDecoderStatus () |
Ask Itoh-san about this. | |
Static Public Member Functions | |
static bool | isMergeable (const TObject *object) |
Is the given object of a type that can be merged? | |
static void | clearMergeable (TObject *object) |
assuming object is mergeable, clear its contents. | |
static void | mergeIntoExisting (TObject *existing, const TObject *received) |
Assuming both objects are mergeable, merge 'received' into 'existing'. | |
static void | removeSideEffects () |
call clear() and removeSideEffects() for all Mergeable objects in datastore (for c_Persistent durability). | |
Static Public Attributes | |
static const unsigned int | c_maxThreads = 16 |
global maximum number of threads (cannot set higher number). | |
static const unsigned int | c_maxQueueDepth = 64 |
Ask Itoh-san. | |
Private Types | |
enum | ETObjectBits { c_IsTransient = BIT(19) , c_IsNull = BIT(20) , c_PersistentDurability = BIT(21) } |
bits to store in TObject. More... | |
Private Member Functions | |
int | restoreStreamerInfos (const TList *list) |
restore StreamerInfo from data in a file | |
Private Attributes | |
MsgHandler * | m_msghandler |
MsgHandler. | |
int | m_compressionLevel |
Compression level in streaming. | |
bool | m_handleMergeable |
Whether to handle Mergeable objects. | |
int | m_initStatus |
first event flag. | |
std::vector< std::string > | m_streamobjnames |
names of object to be streamed | |
int | m_maxthread |
Max. | |
pthread_t | m_pt [c_maxThreads] |
thread pointer | |
int | m_id [c_maxThreads] |
thread index. | |
int | m_threadin |
current thread? | |
int | m_decoderStatus [c_maxThreads] {0} |
thread decoder status. | |
Stream/restore DataStore objects to/from EvtMessage.
Main interface is provided by streamDataStore() and restoreDataStore(). Other functions provide more obscure features.
Definition at line 34 of file DataStoreStreamer.h.
|
private |
bits to store in TObject.
Bits 14-23 are available for use in derived classes, and are reused here to transmit additional information. This is really quite ugly and should be replaced with some more sane way of transmitting object-level data. All bits are checked before using them, so if they are used by other code we know what happens.
Enumerator | |
---|---|
c_IsTransient | The corresponding StoreEntry has flag c_DontWriteOut. |
c_IsNull | object is not valid for current event, set StoreEntry::ptr to NULL. |
c_PersistentDurability | Object is of persistent durability. |
Definition at line 124 of file DataStoreStreamer.h.
|
explicit |
Constructor.
complevel | Compression level of streaming, 0 to disable |
handleMergeable | perform special handling for Mergeable objects? |
maxthread | maximal number of threads, 0 to disable |
Definition at line 58 of file DataStoreStreamer.cc.
~DataStoreStreamer | ( | ) |
|
static |
assuming object is mergeable, clear its contents.
Use this after sending it to prevent sending the same data again in the next event.
Definition at line 111 of file DataStoreStreamer.cc.
void * decodeEvtMessage | ( | int | id | ) |
Decode EvtMessage and store objects in temporary buffer.
id | Thread id |
Definition at line 326 of file DataStoreStreamer.cc.
int getDecoderStatus | ( | ) |
Ask Itoh-san about this.
Definition at line 466 of file DataStoreStreamer.cc.
int getMaxThreads | ( | ) |
maximum number of threads.
Definition at line 461 of file DataStoreStreamer.cc.
|
static |
Is the given object of a type that can be merged?
Definition at line 106 of file DataStoreStreamer.cc.
|
static |
Assuming both objects are mergeable, merge 'received' into 'existing'.
Definition at line 115 of file DataStoreStreamer.cc.
int queueEvtMessage | ( | char * | msg | ) |
Queue EvtMessage for destreaming.
msg | Event buffer to be restored. |
Definition at line 296 of file DataStoreStreamer.cc.
|
static |
call clear() and removeSideEffects() for all Mergeable objects in datastore (for c_Persistent durability).
Definition at line 120 of file DataStoreStreamer.cc.
int restoreDataStore | ( | EvtMessage * | msg | ) |
Restore DataStore objects from EvtMessage.
msg | EvtMessage to be restored. |
Definition at line 207 of file DataStoreStreamer.cc.
int restoreDataStoreAsync | ( | ) |
Restore objects in DataStore from temporary buffer.
Definition at line 394 of file DataStoreStreamer.cc.
|
private |
restore StreamerInfo from data in a file
Definition at line 479 of file DataStoreStreamer.cc.
void setDecoderStatus | ( | int | val | ) |
Ask Itoh-san about this.
Definition at line 472 of file DataStoreStreamer.cc.
void setMaxThreads | ( | int | maxthread | ) |
maximum number of threads.
Definition at line 456 of file DataStoreStreamer.cc.
void setStreamingObjects | ( | const std::vector< std::string > & | list | ) |
Set names of objects to be streamed/destreamed.
Definition at line 101 of file DataStoreStreamer.cc.
EvtMessage * streamDataStore | ( | bool | addPersistentDurability, |
bool | streamTransientObjects = false |
||
) |
Store DataStore objects in EvtMessage.
addPersistentDurability | By default, only c_Event data is streamed. Setting this to true will add c_Persistent data to the EvtMessage. |
streamTransientObjects | Should objects/arrays registered as transient be streamed? |
Definition at line 134 of file DataStoreStreamer.cc.
|
static |
Ask Itoh-san.
Definition at line 39 of file DataStoreStreamer.h.
|
static |
global maximum number of threads (cannot set higher number).
Definition at line 37 of file DataStoreStreamer.h.
|
private |
Compression level in streaming.
Definition at line 137 of file DataStoreStreamer.h.
|
private |
thread decoder status.
Definition at line 168 of file DataStoreStreamer.h.
|
private |
Whether to handle Mergeable objects.
Definition at line 139 of file DataStoreStreamer.h.
|
private |
thread index.
Definition at line 163 of file DataStoreStreamer.h.
|
private |
first event flag.
0 during first event, 1 otherwise.
Definition at line 145 of file DataStoreStreamer.h.
|
private |
Max.
number of threads for asynchronous processing
4 for default
Definition at line 157 of file DataStoreStreamer.h.
|
private |
MsgHandler object used to form/decode EvtMessage
Definition at line 134 of file DataStoreStreamer.h.
|
private |
thread pointer
Definition at line 161 of file DataStoreStreamer.h.
|
private |
names of object to be streamed
If size=0, all objects to be streamed
Definition at line 151 of file DataStoreStreamer.h.
|
private |
current thread?
Definition at line 165 of file DataStoreStreamer.h.