#[derive(Clone, Debug, PartialEq, Eq)]
pub struct IndexVerify {
pub name: Vec<u8>,
pub entries: u64,
pub approx_bytes: u64,
pub coerce_failures: u64,
pub excluded: u64,
pub absent: u64,
pub rows: u64,
pub missing: u64,
pub duplicates: u64,
pub drift: u64,
pub checked: u64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TableVerify {
pub per_index: Vec<IndexVerify>,
pub spot_rows: u64,
pub spot_type_mismatches: u64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TableEnsure {
Created,
Unchanged,
}
#[must_use]
pub fn spec_diff(cur: &crate::TableSpec, new: &crate::TableSpec) -> String {
let part = if cur.prefix != new.prefix {
"PREFIX"
} else if cur.pk != new.pk {
"PK"
} else if cur.columns != new.columns {
"COLUMNS"
} else if cur.indexes != new.indexes {
"INDEXES"
} else if cur.orderpaths != new.orderpaths {
"ORDERPATHS"
} else {
"SPEC"
};
format!(
"ERR table '{}' exists with a different spec ({part} differ); \
TABLE.REPLACE rebuilds, TABLE.DROP + DECLARE is the manual form",
String::from_utf8_lossy(&cur.name)
)
}