13#include "../asrtc/collect.h"
14#include "../asrtl/asrt_assert.h"
15#include "../asrtl/log.h"
16#include "../asrtl/status_to_str.h"
17#include "../asrtlpp/callback.hpp"
18#include "../asrtlpp/flat_type_traits.hpp"
19#include "../asrtlpp/task.hpp"
20#include "../asrtlpp/util.hpp"
27ASRT_NODISCARD
inline status
init(
28 ref< asrt_collect_server > srv,
31 uint32_t tree_block_cap,
32 uint32_t tree_node_cap )
34 return asrt_collect_server_init( srv, &prev, alloc, tree_block_cap, tree_node_cap );
40 ref< asrt_collect_server > srv,
45 return asrt_collect_server_send_ready( srv, root_id, timeout, ack_cb.fn, ack_cb.ptr );
51 return *asrt_collect_server_tree( srv );
55ASRT_NODISCARD
inline flat_id
next_node_id( ref< asrt_collect_server > srv )
57 return srv->next_node_id;
61inline void deinit( ref< asrt_collect_server > srv )
63 asrt_collect_server_deinit( srv );
67struct _collect_send_ready_ctx
69 using completion_signatures =
70 ecor::completion_signatures< ecor::set_value_t(), ecor::set_error_t( status ) >;
76 template <
typename OP >
79 auto s = asrt_collect_server_send_ready(
83 +[](
void* p,
enum asrt_status s ) {
84 auto& o = *
static_cast< OP*
>( p );
85 if ( s == ASRT_SUCCESS )
86 o.receiver.set_value();
88 o.receiver.set_error( s );
91 if ( s != ASRT_SUCCESS )
92 op.receiver.set_error( s );
103 ref< asrt_collect_server > srv,
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: callback.hpp:17
ASRT_NODISCARD flat_id next_node_id(ref< asrt_collect_server > srv)
Return the next node ID the server will assign (useful for pre-allocating root IDs).
Definition: collect.hpp:55
ecor::sender_from< _collect_send_ready_ctx > collect_send_ready_sender
Sender backing co_await send_ready(srv, root_id, timeout).
Definition: collect.hpp:98
ASRT_NODISCARD enum asrt_status init(ref< asrt_cntr_assm > assm, asrt_allocator alloc)
Initialise the controller assembly — wires controller, diag, param, collect and stream channels.
Definition: cntr_assm.hpp:25
ASRT_NODISCARD status send_ready(ref< asrt_collect_server > srv, flat_id root_id, callback< asrt_collect_ready_ack_cb > ack_cb, uint32_t timeout)
Send a READY message to the reactor to start a collection session rooted at root_id.
Definition: collect.hpp:39
asrt_flat_tree const & tree(ref< asrt_collect_server > srv)
Access the flat_tree assembled from incoming APPEND messages.
Definition: collect.hpp:49
void deinit(ref< asrt_cntr_assm > assm)
Release all resources owned by the assembly.
Definition: cntr_assm.hpp:52
A type-erasing wrapper for C-style callback + void* pairs.
Definition: callback.hpp:27
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: allocator.h:28
Controller-side collect server (ASRT_COLL channel).
Definition: collect.h:55
node_id maps to blocks[node_id / node_capacity][node_id % node_capacity].
Definition: flat_tree.h:121
A node in a doubly-linked channel chain.
Definition: chann.h:122