1 #ifndef LIBFILEZILLA_AIO_HEADER
2 #define LIBFILEZILLA_AIO_HEADER
8 #include "../event.hpp"
9 #include "../mutex.hpp"
10 #include "../nonowning_buffer.hpp"
16 class aio_buffer_pool;
39 explicit operator bool()
const {
return pool_ !=
nullptr; }
78 virtual void on_buffer_availability(
aio_waitable const* w) = 0;
102 void remove_waiters();
108 void signal_availibility();
111 bool FZ_PRIVATE_SYMBOL is_signalling(
aio_waiter* w)
const;
114 std::vector<aio_waiter*> waiting_;
115 std::vector<event_handler*> waiting_handlers_;
116 std::vector<aio_waiter*> active_signalling_;
120 struct aio_buffer_event_type{};
122 typedef simple_event<aio_buffer_event_type, aio_waitable const*> aio_buffer_event;
124 class logger_interface;
137 aio_buffer_pool(
logger_interface & logger,
size_t buffer_count = 1,
size_t buffer_size = 0,
bool use_shm =
false, std::string_view application_group_id = {});
141 ~aio_buffer_pool() noexcept;
143 operator bool()
const {
144 return memory_ !=
nullptr;
162 typedef void* shm_handle;
163 static shm_handle
const shm_handle_default;
166 typedef int shm_handle;
167 static shm_handle constexpr shm_handle_default{-1};
189 std::tuple<shm_handle, uint8_t const*, size_t> shared_memory_info()
const;
191 size_t buffer_count()
const {
return buffer_count_; }
201 uint64_t memory_size_{};
204 std::vector<nonowning_buffer> buffers_;
206 shm_handle shm_{shm_handle_default};
208 size_t const buffer_count_{};
228 virtual ~
aio_base() noexcept =
default;
230 using size_type = uint64_t;
231 static constexpr
auto nosize =
static_cast<size_type
>(-1);
Similar to fz::buffer, but does not own memory.
Definition: nonowning_buffer.hpp:22
Simple handler for asynchronous event processing.
Definition: event_handler.hpp:54
aio_result
Result of aio operations.
Definition: aio.hpp:212
A buffer pool for use with async readers/writers.
Definition: aio.hpp:131
The namespace used by libfilezilla.
Definition: apply.hpp:17
Lean replacement for std::(recursive_)mutex.
Definition: mutex.hpp:51
Abstract interface for logging strings.
Definition: logger.hpp:50