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
pub use dao::LeafDao;
pub use error::{Error, Result};
pub use segment::SegmentIDGen;

#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");

#[cfg(all(feature = "runtime-tokio", feature = "runtime-async-std"))]
compile_error!("only one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");

pub mod dao;
pub mod error;
pub mod segment;
mod utils;

#[derive(Debug, Copy, Clone, serde::Deserialize, serde::Serialize)]
#[cfg_attr(
    any(feature = "mysql", feature = "postgres", feature = "sqlite"),
    derive(sqlx::FromRow)
)]
/// data stored in DB
pub struct Leaf {
    /// unique identifier
    pub tag: i32,
    pub max_id: i64,
    /// step when updating `max_id`
    pub step: i32,
}