Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_BLOBS_HPP
10 #define EAGINE_MESSAGE_BUS_BLOBS_HPP
12 #include "../callable_ref.hpp"
13 #include "../double_buffer.hpp"
14 #include "../main_ctx_object.hpp"
15 #include "../memory/buffer_pool.hpp"
16 #include "../memory/split_block.hpp"
17 #include "../timeout.hpp"
18 #include "../valid_if/positive.hpp"
29 std::uint64_t blob_id{0U};
30 memory::buffer blob{};
33 double_buffer<std::vector<std::tuple<span_size_t, span_size_t>>>
45 return std::chrono::duration_cast<message_age>(max_time.elapsed_time());
48 auto is_complete() const noexcept ->
bool;
52 class blob_manipulator : main_ctx_object {
55 : main_ctx_object{
EAGINE_ID(BlobManipl), parent} {}
61 auto message_size(
const pending_blob&,
span_size_t max_message_size)
64 auto cleanup() -> bool;
71 std::chrono::seconds max_time,
74 auto push_incoming_fragment(
85 auto process_incoming(filter_function,
const message_view&) -> bool;
92 using send_handler =
callable_ref<bool(message_id,
const message_view&)>;
94 auto has_outgoing() const noexcept ->
bool {
95 return !_outgoing.empty();
97 auto process_outgoing(send_handler,
span_size_t max_data_size) -> bool;
100 std::int64_t _max_blob_size{16 * 1024 * 1024};
101 std::uint64_t _blob_id_sequence{0};
102 memory::buffer _scratch_buffer{};
103 memory::buffer_pool _buffers{};
104 std::vector<pending_blob> _outgoing{};
105 std::vector<pending_blob> _incoming{};
112 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
113 #include <eagine/message_bus/blobs.inl>
115 #endif // EAGINE_MESSAGE_BUS_BLOBS_HPP
const main_ctx_object_parent_info & main_ctx_parent
Alias for main_ctx_object_parent_info parameter type.
Definition: main_ctx_fwd.hpp:24
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
valid_if< T, valid_if_positive_policy< T > > valid_if_positive
Specialization of valid_if, for values valid if positive.
Definition: positive.hpp:44
#define EAGINE_ID(NAME)
Macro for constructing instances of eagine::identifier.
Definition: identifier.hpp:353
static constexpr auto span_size(T v) noexcept
Converts argument to span size type.
Definition: types.hpp:59
basic_split_block< true > const_split_block
Alias for const split blocks.
Definition: split_block.hpp:29
basic_block< true > const_block
Alias for const byte memory span.
Definition: block.hpp:32
basic_callable_ref< Sig, is_noexcept_function_v< Sig > > callable_ref
Alias for callable object references.
Definition: callable_ref.hpp:191
basic_block< false > block
Alias for non-const byte memory span.
Definition: block.hpp:27
@ source_id
The source has been verified.
message_priority
Message priority enumeration.
Definition: message.hpp:58
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
@ normal
Normal, default message priority.
std::uint64_t identifier_t
The underlying integer type for eagine::identifier.
Definition: identifier_t.hpp:19
@ message_id
The message type id has been verified.
std::chrono::duration< float > message_age
Alias for message age type.
Definition: message.hpp:54