19 std::shared_ptr<broker::interface> broker,
20 std::shared_ptr<logging::log> log,
23 m_srv(std::move(srv)) {
24 m_srv->register_handler_callback(
25 [&](
request req, server_type::response_callback_type callback) {
26 return request_handler(std::move(req), std::move(callback));
31 m_log->trace(
"Agent server shutting down...");
33 m_log->trace(
"Shut down agent server");
40 auto server::request_handler(
request req,
41 server_type::response_callback_type callback)
43 m_log->trace(
"received request with m_function ",
44 req.m_function.to_hex(),
47 auto id = m_next_id++;
49 auto agent = std::make_shared<impl>(
57 auto success = std::holds_alternative<return_type>(res);
59 auto ec = std::get<interface::error_code>(res);
60 if(ec == interface::error_code::retry) {
61 m_retry_queue.push(id);
66 m_cleanup_queue.push(
id);
69 req.m_is_readonly_run,
73 std::unique_lock l(m_agents_mut);
74 m_agents.emplace(
id, agent);
std::variant< return_type, error_code > exec_return_type
Return type from function execution.
Server interface for an agent.
auto init() -> bool override
Initializes the server.
~server() override
Stops the server.
Runner factory for agents to intiantiate new runners of a particular type while only worrying about t...
static constexpr auto initial_lock_type
Lock type to acquire when requesting the function code.
Agent contract execution RPC request message.
Configuration parameters for a phase two system.