#[cfg(feature = "postgres")]
mod postgres;
#[cfg(feature = "postgres")]
mod postgres_authority;
#[cfg(feature = "postgres")]
mod postgres_cases;
#[cfg(feature = "postgres")]
mod postgres_disclosures;
#[cfg(feature = "postgres")]
mod postgres_memory;
#[cfg(all(feature = "postgres", feature = "push"))]
mod postgres_push;
#[cfg(feature = "postgres")]
mod postgres_quota;
#[cfg(all(feature = "postgres", feature = "manifest"))]
mod postgres_registry;
#[cfg(feature = "redb")]
mod redb;
#[cfg(feature = "redb")]
mod redb_authority;
#[cfg(feature = "redb")]
mod redb_batches;
#[cfg(feature = "redb")]
mod redb_cases;
#[cfg(feature = "redb")]
mod redb_disclosures;
#[cfg(feature = "redb")]
mod redb_events;
#[cfg(feature = "redb")]
mod redb_memory;
#[cfg(all(feature = "redb", feature = "push"))]
mod redb_push;
#[cfg(feature = "redb")]
mod redb_quota;
#[cfg(all(feature = "redb", feature = "manifest"))]
mod redb_registry;
#[cfg(feature = "redb")]
mod redb_tasks;
#[cfg(feature = "redb")]
mod redb_timers;
#[cfg(feature = "postgres")]
pub use postgres::PostgresStore;
#[cfg(feature = "redb")]
pub use redb::RedbStore;
pub(crate) fn decode_operator(
actor: &str,
basis: &str,
table: &str,
) -> Result<crate::core::Operator, crate::core::StoreError> {
crate::core::Operator::from_parts(actor, basis).map_err(|e| crate::core::StoreError::Corrupt {
seq: 0,
detail: format!("{table} holds an act this build cannot attribute: {e}"),
})
}
#[derive(serde::Serialize, serde::Deserialize)]
pub(crate) struct HaltRow {
pub reason: String,
pub by: crate::core::Operator,
#[serde(with = "time::serde::rfc3339")]
pub at: crate::core::Timestamp,
}
#[derive(serde::Serialize, serde::Deserialize)]
pub(crate) struct HoldRow {
pub reason: String,
pub by: crate::core::Operator,
}
pub(crate) fn halt_from_row(scope: crate::quota::HaltScope, row: HaltRow) -> crate::quota::Halt {
crate::quota::Halt {
scope,
reason: row.reason,
by: row.by,
at: row.at,
}
}
#[cfg(feature = "redb")]
pub(crate) fn hold_row(h: &crate::core::LegalHold) -> HoldRow {
HoldRow {
reason: h.reason.clone(),
by: h.by.clone(),
}
}
pub(crate) fn hold_from_row(
placed_at: crate::core::Timestamp,
row: HoldRow,
) -> crate::core::LegalHold {
crate::core::LegalHold {
placed_at,
reason: row.reason,
by: row.by,
}
}