Adapter to integrate the EOS event loop with an external event loop. Subclass this class to be able to handle the file descriptors and timers that the EOS code needs to dispatch to your event loop implementation.
When you provide your implementation of event_loop_handler to the event_loop, EOS code will start calling the watch_* methods to (un)register its interest in various file descriptors, so that you can hook them up into your event loop implementation. When those file descriptors become ready, you must call the corresponding on_*() method in a timely fashion for the EOS code to run.
The on_*() methods are all non-blocking methods.
Public Functions
Notifies the EOS event loop that the file descriptor is readable.
Notifies the EOS event loop that the file descriptor is writable.
Notifies the EOS event loop that the file descriptor has exceptions.
Notifies the EOS event loop that its next timer has expired.
Called by EOS to (un)register its interest in a fd being readable.
Called by EOS to (un)register its interest in a fd being writable.
Called by EOS to (un)register its interest in a fd having exceptions.
Called to register when is the next timeout that EOS code must handle. The deadline passed in argument is relative to now (so for instance if the next timer the EOS code need to handle is in 5 seconds from now, then the deadline will be 5 seconds, not “now + 5s”). If this function is called multiple times, subsequent calls should override the timeout set by previous calls. In other words, there is only one timeout associated with this function, instead of each call creating a new timeout.
The EOS event loop.
This class represents the event loop that is built into EOS code. It can be used to run this loop on demand, or to integrate this event loop with an external event loop, such as that provided by libevent or other third-party code.
Public Functions
Wait for all managers to be initialized. Generally called right after creating the event_loop, as an alternative to creating an agent_handler and then waiting for on_initialized to be called.
This method is a blocking method. It may block for any amount of time that is necessary to wait for the initial state sync from Sysdb.
Run the event loop for `duration` seconds. If no duration is specified, all pending events will be executed and control will be returned to the caller.
Registers an external event loop to use instead of EOS’s.
Upon calling this function, the EOS code will start registering its file descriptors and its next timeout with the given handler, and will start expecting that an external event loop will deliver events to the handler in a timely fashion.
If wait_for_initialized() hasn’t been called already, this method is a blocking method. It may block for any amount of time that is necessary to wait for the initial state sync from Sysdb.
Private Functions
Friends