aetherlight: partition read indexes owned by Docs; eight whole-partition scans become index reads
A Docs may carry a Projection: a pure function of one document's value. Docs::finish folds each changed key (old points out, new points in) from the list the digest folds; Docs::indexed returns (point, key) in order, corrected by the open log so it is true mid-transaction; rollback never touches the index. Seven projections: DueAt, StandsAt, ChildOf, BySource, ByEndpoint, ByController, ByIncumbent. under_place, audience Colocated, DischargeCommitment holders, scope_components routes and controls, delegated_authority, derive_motion's commitments and reachable's outbound edges now read the index; each old scan is kept as a cfg(test) *_by_scan reference. golden.digests byte-identical. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
436c6d59ca
commit
edeea42f5e
6 changed files with 555 additions and 84 deletions
|
|
@ -129,12 +129,20 @@ pub(crate) trait Partition {
|
|||
/// Removes the first document, logged like any write; false when empty.
|
||||
#[cfg(test)]
|
||||
fn remove_first(&mut self) -> bool;
|
||||
/// Whether the read index is exactly the projection of the documents.
|
||||
#[cfg(test)]
|
||||
fn index_is_derived(&self) -> bool;
|
||||
/// Damages the read index in one place (a stray entry, else a missing one);
|
||||
/// false when there is nothing to damage.
|
||||
#[cfg(test)]
|
||||
fn corrupt_index_first(&mut self, stray: bool) -> bool;
|
||||
}
|
||||
|
||||
impl<K, V> Partition for Docs<K, V>
|
||||
impl<K, V, P> Partition for Docs<K, V, P>
|
||||
where
|
||||
K: Ord + Clone + DocKey + Serialize,
|
||||
V: Clone + PartialEq + Serialize,
|
||||
P: crate::docs::Projection<V>,
|
||||
{
|
||||
fn is_clean(&self) -> bool {
|
||||
Docs::is_clean(self)
|
||||
|
|
@ -186,6 +194,16 @@ where
|
|||
};
|
||||
self.remove(&key).is_some()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn index_is_derived(&self) -> bool {
|
||||
Docs::index_is_derived(self)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn corrupt_index_first(&mut self, stray: bool) -> bool {
|
||||
self.corrupt_index_for_test(stray)
|
||||
}
|
||||
}
|
||||
|
||||
/// The header's one change, keyed by its own world id.
|
||||
|
|
|
|||
Loading…
Reference in a new issue