aion_server/routing/mod.rs
1//! Distributed request routing — the gRPC-edge availability layer over the
2//! epoch fence (DISTRIBUTED-ROUTING-DESIGN §2).
3//!
4//! A node that is not the current owner of `shard_for(workflow_id)` cannot win
5//! the quorum CAS for that workflow's writes: the owner's promised ballot fences
6//! the proposal (surfaced as [`aion_store::StoreError::NotOwner`], R-0). Routing
7//! turns that correctness backstop into an *availability* layer: at the edge we
8//! resolve the shard owner and either proceed locally, forward to the owner
9//! (R-3), or return the typed retryable `NotOwner` so the caller re-resolves.
10//!
11//! This module only ever does anything for a distributed (`[store.cluster]`)
12//! boot. With no cluster store on
13//! [`crate::ServerState`] every entry point short-circuits to "proceed locally",
14//! so the default single-node path is byte-identical — the fence is never even
15//! reachable there.
16//!
17//! ## Staging
18//!
19//! - **R-1 (here):** a `shard_for`-aware edge guard for signal/query/cancel on a
20//! non-owned shard (return `NotOwner`), plus an unsteered-start remint so a
21//! `start` whose default-minted id would land off-owner is re-minted onto a
22//! locally-owned shard and never fences (§2.4 stopgap).
23//! - **R-2:** a `ShardDirectory` trait + static resolver so the edge knows the
24//! *remote* owner's gRPC address, not just "not me".
25//! - **R-3:** a `RequestForwarder` trait + gRPC forwarder that relays a non-local
26//! request to the owner instead of rejecting it.
27
28mod directory;
29mod edge;
30mod forwarder;
31mod relay;
32
33pub use directory::{DirectoryPeer, NodeRef, OwnerView, ShardDirectory, StaticShardDirectory};
34pub use edge::{
35 RemintOutcome, RouteDecision, SteerDecision, route_mutation, route_start, route_start_steered,
36};
37pub use forwarder::{
38 FORWARD_HOPS_METADATA, ForwardReply, ForwardRequest, GrpcRequestForwarder, MAX_FORWARD_HOPS,
39 RequestForwarder, current_hops,
40};
41pub use relay::{not_owner_wire, owner_refusal};