//! per-mode event sinks for the shared firehose worker.
//!
//! the worker validates and persists repo state the same way in every mode;
//! what differs is where accepted events go: the indexer forwards them to the
//! `FirehoseWorker` hook, the relay re-sequences and re-emits them (plus
//! optional jetstream events), and a bare build drops them. each mode is a
//! parallel module with an identical interface, selected once here.
#[cfg(feature = "indexer")]
mod indexer;
#[cfg(feature = "indexer")]
pub(crate) use indexer::*;
#[cfg(feature = "relay")]
mod relay;
#[cfg(feature = "relay")]
pub(crate) use relay::*;
#[cfg(not(any(feature = "indexer", feature = "relay")))]
mod none;
#[cfg(not(any(feature = "indexer", feature = "relay")))]
pub(crate) use none::*;
/// puts a row a message staged on `txn`, for builds where the relay shard is the row's only
/// writer, and moves a host's limit status with the account count the row changes
#[cfg(not(feature = "indexer"))]
fn put_row(
state: &crate::state::AppState,
txn: &mut crate::db::Txn<'_>,
did: &jacquard_common::types::did::Did,
row: &crate::types::RepoState<'_>,
) -> miette::Result<()> {
for host in txn.put_repo(did, row)?.hosts() {
let count = txn.counts.projected_pds_account_count(&state.db, &host);
state.apply_host_limit_status(&mut txn.batch, &host, count);
}
Ok(())
}