Skip to main content

s2_lite/backend/
mod.rs

1use s2_common::encryption::EncryptionSpec;
2
3pub mod error;
4
5mod basins;
6pub mod bgtasks;
7mod core;
8mod durability_notifier;
9mod read;
10mod store;
11mod streamer;
12mod streams;
13
14mod append;
15mod kv;
16
17pub use core::Backend;
18
19pub use crate::stream_id::StreamId;
20
21pub struct StreamHandle {
22    db: slatedb::Db,
23    client: streamer::GuardedStreamerClient,
24    encryption: EncryptionSpec,
25}
26
27pub const FOLLOWER_MAX_LAG: usize = 25;
28
29#[derive(Debug, Clone, PartialEq, Eq)]
30pub enum CreatedOrReconfigured<T> {
31    Created(T),
32    Reconfigured(T),
33}
34
35impl<T> CreatedOrReconfigured<T> {
36    pub fn is_created(&self) -> bool {
37        matches!(self, Self::Created(_))
38    }
39
40    pub fn into_inner(self) -> T {
41        match self {
42            Self::Created(v) | Self::Reconfigured(v) => v,
43        }
44    }
45}