dtlmod::Engine
-
class Engine
A class that interface the Stream defined by users and the Transport methods that actually handle data movement and storage.
Public Types
Public Functions
-
void begin_transaction()
Start a transaction on an Engine.
All put and get operations must take place within a transaction (in a sense close to that used for databases). When multiple actors have opened the same Stream and thus subscribed to the same Engine, only one of them has to do the following when a transaction begins, this function is a no-op for the other subscribers:
if no transaction is currently in progress, start one, exit otherwise
if this is the first transaction for that Engine, create a synchronization barrier among all the subscribers.
Otherwise, wait for the completion of the simulated activities started by the previous transaction.
-
void close()
Close the Engine associated to a Stream.
This function is called by all the actors that have opened that Stream. The first subscriber to enter that function waits for the completion of the activities of last transaction on that Engine. Then all the subscribers are synchronized before the Engine is properly closed (and destroyed).
-
void end_transaction()
End a transaction on an Engine.
This function first synchronizes all the subscribers thanks to the internal barrier. When the last subscriber enters the barrier, all the simulated activities registered for the current transaction are started.
Then it marks the transaction as done.
-
The actual data transport is delegated to the Transport method associated to the Engine.
-
inline const char *get_cname() const
Helper function to print out the name of the Engine.
- Returns:
the corresponding C-string
-
inline unsigned int get_current_transaction() const
Get the id of the current transaction (on the Publish side).
- Returns:
The id of the ongoing transaction.
-
void begin_transaction()