Functions
A reference to the default signal handler.
This handler is installed for SIGTERM and SIGINT so agents cleanly exit the event loop upon receiving those signals. This function is exposed for agents that install their own signal handlers. If desired, the agent can call this function from its new signal handler, or re-install this if it no longer wants to use a custom signal handler.
It should be used for specific applications that attempt to do large numbers of updates without yielding to the event loop. It should only be rarely used, and future versions of EOS will eliminate the need for this method entirely. At that point, this method will be removed, so please contact the EOS SDK developers before using this method.
To use, call this method at the beginning of your on_initialized() callback.
This method takes in a number of bytes that the buffer should be. By default, this buffer size is set to 8.3 MB (which the kernel doubles to 16.7 MB) - the max kernel buffer size.
Unlike setsockopt, the number of bytes you pass to this function is NOT doubled for setting the actual socket buffer size. Note though that the new buffer size may not exactly match the requested buffer size, but we guarantee that it the new size is at least as big as the requested size.
The following lock lets multiple threads use the SDK simultaneously. This lock uses the RAII idiom; in multithreaded environments, instantiate an eos::sdk_scoped_lock before using any eos::sdk features. Users do not need to grab a lock if they only have one thread, or if they perform all operations on the SDK from the thread which owns the `main_loop`, as the SDK grabs the lock before calling any *_handler callbacks and before performing any internal bookkeeping. Do note that the lock is re-entrant, so attempting to grab the lock twice is fine. Example usage:
Thread 1: running sdk.main_loop()
Thread 2: { // Start a new scope to hold the lock eos::sdk_scoped_lock ssl; sdk.get_agent_mgr()->status_set(“Look”, “I can interact with Sysdb!”); } // End the scope, causing the sdk_scoped_lock to be destructed and released
Public Functions
Private Members
Manages the different managers of the SDK. One manager of each type can be linked to a SDK object.
As managers must be initialized at the beginning of the program, the init_*_mgr() functions should be called for any managers you plan to use. Since the get_*_mgr() functions also call their respective init_*_mgr() functions if necessary, accessing the managers at the beginning of the code (before the agent_loop is called) is enough to initialize them.
Public Functions
Constructs a top level SDK object.
This constructor will read the AGENT_PROCESS_NAME environment variable to determine the operational name of the agent. When running this agent via the CLI, this variable will be set automatically. If running an agent that uses this constructor manually, the AGENT_PROCESS_NAME variable must be set.
Construct an SDK object with an explicitly set name. If running an agent using this constructor from the CLI, note that the name used here must match the name used in the CLI configuration.
Return the name of this SDK object.
This variable is used to register the process with EOS’s various agent services, including the process name, the name used in the log file, as well as the namespace for custom agent configuration and status.
Begin the agent’s event loop.
This function initializes the underlying infrastructure for your agent. It first registers itself as an EOS agent, then synchronizes any needed state with Sysdb, and finally starts the event loop. Before this function is called, no managers are valid (as no state has been synchronized with Sysdb), and no handlers will be triggered (as the event loop is not running). This function will not return unless the agent is disabled or it explicitly calls the agent_mgr’s exit() code.
Private Functions
Private Members
Friends
Enums
Enums for Manager mode type.
Values:
Reader without notifications.
Reader with notifications.
Writer, manager can read and write state.