1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 FernTech
//! Event queue — `EventQueue` trait + two impls.
//!
//! Adapters that buffer events for later transmission depend on the
//! [`EventQueue`] trait so the choice of in-memory vs. persistent
//! backing is a deployment detail. Both impls have the same FIFO
//! semantics (oldest event drained first); only [`PersistentEventQueue`]
//! survives process restart.
//!
//! - [`InMemoryEventQueue`] — `Mutex<VecDeque<OwnedEvent>>`. Default
//! for tests and for adapters that consider events ephemeral.
//! - [`PersistentEventQueue`] — backed by [redb] at a path under
//! [`AppPaths::data_dir()`](teksilo_settings::AppPaths::data_dir).
//! Pure-Rust, no C deps, ~250–400 KB binary footprint vs. SQLite's
//! ~1 MB. Atomic writes, MVCC reads, single-writer.
//!
//! [redb]: https://crates.io/crates/redb
pub use InMemoryEventQueue;
pub use ;
use OwnedEvent;
/// FIFO event buffer with capped size and oldest-eviction.
///
/// `Send + Sync` is required because adapters typically own a worker
/// thread that drains the queue while the UI thread pushes; the
/// trait's contract is "thread-safe enough for a producer/consumer
/// pair."