pub struct TenancyRouter<T> { /* private fields */ }Expand description
Turns a TenancySpi implementation into a RoutingSpi.
Implementations§
Source§impl<T: TenancySpi> TenancyRouter<T>
impl<T: TenancySpi> TenancyRouter<T>
Sourcepub async fn admit_write(&self, partition: &PartitionId, epoch: Epoch) -> bool
pub async fn admit_write(&self, partition: &PartitionId, epoch: Epoch) -> bool
The migration write gate for a resolved decision (docs/06 §2): whether a
write that resolved at epoch for partition may still commit. The
engine calls this at dispatch; false is surfaced as a retryable
stale-epoch error. Delegates to the TenancySpi.
Sourcepub fn resolve_partition(
&self,
ctx: &RequestCtx<'_>,
body: BodyDoc<'_>,
) -> Result<PartitionId, SpiError>
pub fn resolve_partition( &self, ctx: &RequestCtx<'_>, body: BodyDoc<'_>, ) -> Result<PartitionId, SpiError>
Resolves just the partition id for a request and document, without a
placement lookup. The per-document entry point for bulk demux (docs/04
§3), where each operation carries its own source as a BodyDoc.
§Errors
Returns SpiError::PartitionUnresolved if no configured source yields
the partition.
Sourcepub async fn resolve_placement(
&self,
ctx: &RequestCtx<'_>,
partition: PartitionId,
logical_index: &str,
) -> Result<Resolved, SpiError>
pub async fn resolve_placement( &self, ctx: &RequestCtx<'_>, partition: PartitionId, logical_index: &str, ) -> Result<Resolved, SpiError>
Resolves a known partition to its placement and the routing plan for a
given logical index. Separated from Self::resolve_partition so a bulk
request can resolve the partition per document but cache the placement
per partition.
§Errors
Returns SpiError if no placement exists or the configured transforms
are invalid (e.g. a shared-index id rule that omits the partition).
Trait Implementations§
Source§impl<T: Debug> Debug for TenancyRouter<T>
impl<T: Debug> Debug for TenancyRouter<T>
Source§impl<T: TenancySpi> Router for TenancyRouter<T>
impl<T: TenancySpi> Router for TenancyRouter<T>
Source§async fn resolve(&self, ctx: &RequestCtx<'_>) -> Result<Resolved, SpiError>
async fn resolve(&self, ctx: &RequestCtx<'_>) -> Result<Resolved, SpiError>
Source§fn resolve_partition(
&self,
ctx: &RequestCtx<'_>,
body: BodyDoc<'_>,
) -> Result<PartitionId, SpiError>
fn resolve_partition( &self, ctx: &RequestCtx<'_>, body: BodyDoc<'_>, ) -> Result<PartitionId, SpiError>
Source§async fn resolve_placement(
&self,
ctx: &RequestCtx<'_>,
partition: PartitionId,
logical_index: &str,
) -> Result<Resolved, SpiError>
async fn resolve_placement( &self, ctx: &RequestCtx<'_>, partition: PartitionId, logical_index: &str, ) -> Result<Resolved, SpiError>
Source§async fn admit_write(&self, partition: &PartitionId, epoch: Epoch) -> bool
async fn admit_write(&self, partition: &PartitionId, epoch: Epoch) -> bool
epoch for
partition still commit? false ⇒ reject as a retryable stale-epoch error.