Skip to main content

admit_durable_write

Function admit_durable_write 

Source
pub fn admit_durable_write<'c>(
    catalog: &'c ShardOwnershipCatalog,
    holder: &LeasedOwner,
    node: &NodeIdentity,
    collection: &CollectionId,
    key: &[u8],
    current_term: SupervisorTerm,
    now_ms: u64,
) -> Result<&'c RangeOwnership, DurableWriteReject>
Expand description

The combined durable-write gate: catalog ownership and a valid lease.

Routes key to its range, requires node to be the range’s current Owner (the issue #990 gate), then requires holder to hold a lease that covers this range and is valid at current_term / now_ms against the range’s current ownership epoch. On success returns the owned RangeOwnership; otherwise the DurableWriteReject explaining which layer refused.

This is the literal encoding of the acceptance criterion “durable writes require a valid current ownership lease in addition to matching range ownership”: catalog ownership is necessary but not sufficient, and the lease is checked against the catalog’s current epoch, so an owner whose lease epoch has been superseded by a transition is fenced here too.