#![cfg_attr(docsrs, feature(doc_cfg))]
mod expr;
mod query;
mod row;
mod schema;
mod sub_table;
mod table;
mod val;
use std::{fmt::Debug, future::Future};
pub use expr::{Expr, Op, Order};
use hipstr::HipByt;
pub use query::Query;
pub use row::{AsyncRow, Row};
pub use schema::{Field, Index, Schema, SchemaVer};
pub use sub_table::SubTable;
pub use table::Table;
pub use val::Val;
pub type Id = u64;
pub type Col = HipByt<'static>;
pub type ColIdx = u16;
pub type SubTableKey = Row;
#[derive(Debug)]
pub struct AsyncItem<R: AsyncRow> {
pub sub_table: SubTableKey,
pub id: Id,
pub row: R,
}
pub trait IdGen: Send + Sync {
type Error: Debug + Send + Sync;
fn get(&self) -> impl Future<Output = Result<Id, Self::Error>> + Send;
}
pub trait Engine: Sized + Send + Sync {
type Error: Debug + Send + Sync;
type Gen: IdGen;
type Table: Table;
fn id_gen(&self) -> &Self::Gen;
fn open<F, Fut>(
&self,
name: &[u8],
create: F,
) -> impl Future<Output = Result<Self::Table, Self::Error>> + Send
where
F: FnOnce() -> Fut + Send,
Fut: Future<Output = Schema> + Send;
}