use nodedb_crdt::validator::ValidationOutcome;
use nodedb_types::Surrogate;
use super::core::{TenantCrdtEngine, TenantRowLookup};
impl TenantCrdtEngine {
pub fn validate_committed_row(
&self,
collection: &str,
row_id: &str,
surrogate: Surrogate,
) -> ValidationOutcome {
let Some(state) = self.collections.get(collection) else {
return ValidationOutcome::Accepted;
};
let Some(change) = state.build_change_from_row(collection, row_id, surrogate) else {
return ValidationOutcome::Accepted;
};
let view = TenantRowLookup {
collections: &self.collections,
array_surrogate_ids: &self.array_surrogate_ids,
};
self.validator.validate(&view, &change)
}
}