s2-lite 0.31.0

Lightweight server implementation of S2, the durable streams API, backed by object storage
Documentation
use s2_common::encryption::EncryptionSpec;

pub mod error;

mod basins;
pub mod bgtasks;
mod core;
mod durability_notifier;
mod read;
mod store;
mod streamer;
mod streams;

mod append;
mod kv;

pub use core::Backend;

pub use crate::stream_id::StreamId;

pub struct StreamHandle {
    db: slatedb::Db,
    client: streamer::GuardedStreamerClient,
    encryption: EncryptionSpec,
}

pub const FOLLOWER_MAX_LAG: usize = 25;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CreatedOrReconfigured<T> {
    Created(T),
    Reconfigured(T),
}

impl<T> CreatedOrReconfigured<T> {
    pub fn is_created(&self) -> bool {
        matches!(self, Self::Created(_))
    }

    pub fn into_inner(self) -> T {
        match self {
            Self::Created(v) | Self::Reconfigured(v) => v,
        }
    }
}