uqa_storage/mvcc/vector_fields.rs
1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Physical layouts identify field coordination records; common MVCC owns their retirement.
8
9use uqa_core::memory::BudgetedVec;
10
11use crate::read_control::StorageReadControl;
12
13use super::VersionResult;
14
15/// The two coordination keys and their canonical vector domain. Buffers retain the invoking maintenance allowance.
16pub struct VectorFieldGuard {
17 pub lifetime: BudgetedVec<u8>,
18 pub references: BudgetedVec<u8>,
19 pub reference_value: BudgetedVec<u8>,
20 pub vectors: BudgetedVec<u8>,
21}
22
23/// Decode only this provider's internal vector-field guard namespace. A lifetime key returns `None`; a reference key supplies its exact immutable value and paired lifetime. Malformed keys reject, and neighboring metadata is outside `prefix`.
24pub trait VectorFieldGuardLayout: Send + Sync {
25 fn prefix(&self, control: &StorageReadControl) -> VersionResult<BudgetedVec<u8>>;
26
27 fn reference(
28 &self,
29 key: &[u8],
30 control: &StorageReadControl,
31 ) -> VersionResult<Option<VectorFieldGuard>>;
32}