pub enum RoutePolicy {
Requires,
CachePolicy,
Concurrency,
Resilience,
}Expand description
A route field that changes serving behaviour, and can therefore fail open when the serving tier does not implement it.
Deliberately not “every field on crate::manifest::Route” — build-time
and publish-time fields (prerender, data_inputs, placement,
source_reads, hydration) are consumed before a request exists, so a
server that ignores them cannot serve a route that quietly lacks a policy
it declared. See STRUCTURAL_FIELDS for that half of the partition;
every key on Route belongs to exactly one of the two, pinned by
every_route_field_is_classified.
Variants§
Requires
requires: ["user" | "project" | "region"] — the auth gate. The one
whose fail-open is a confidentiality breach rather than a performance
regression, which is why R556-B13 was filed at severity high.
CachePolicy
cache_policy: { ttl, swr, negative_ttl, vary }.
Concurrency
concurrency — per-route in-flight cap.
Resilience
resilience: { retry, timeout_ms } (W181).
Implementations§
Source§impl RoutePolicy
impl RoutePolicy
Sourcepub const ALL: [RoutePolicy; 4]
pub const ALL: [RoutePolicy; 4]
Every policy, in declaration order. Nothing at compile time checks this
list is complete — parse() searches it at runtime — so a variant left
out here is caught only by every_route_field_is_classified below.
Sourcepub const fn field(self) -> &'static str
pub const fn field(self) -> &'static str
The manifest / defineRoutes field name. This is what an author reads
in their own routes file, so it is what a refusal message must name.
Sourcepub const fn effect(self) -> &'static str
pub const fn effect(self) -> &'static str
What an author expects the field to do, one clause. Rendered into the refusal so the message says what is being lost, not just which key.
Sourcepub fn parse(field: &str) -> Option<Self>
pub fn parse(field: &str) -> Option<Self>
Parse a field name, for --policy-delegated / MESOFACT_POLICY_DELEGATED.
Sourcepub const fn subfields(self) -> &'static [&'static str]
pub const fn subfields(self) -> &'static [&'static str]
For a policy carried as a JSON object, the sub-keys this build actually implements. Empty = the policy is a scalar/array with no inner shape.
Checked as strictly as the top level, because a policy’s sub-field is
the same defect one level down and hides better: serde on
crate::manifest::CachePolicy silently drops an unknown key, so a
cache_policy.private added by a newer build would deserialize into a
policy that looks complete and quietly is not.
resilience.queue is deliberately absent — W181 reserves the slot
for v2 and defineRoutes rejects it today, so the type exists only so
v1 binaries keep deserializing v2 manifests. Deserializing one is not
the same as honouring it; a manifest that carries a queue policy must
not be served as though the queueing happens.
Sourcepub const fn reserved_subfields(self) -> &'static [&'static str]
pub const fn reserved_subfields(self) -> &'static [&'static str]
Sub-keys that exist on the manifest type and are deliberately not
implemented. Listing them is what turns “we left it out” into a
decision the completeness gate can check, and it keeps
subfields’s omissions from reading as oversights.
Trait Implementations§
Source§impl Clone for RoutePolicy
impl Clone for RoutePolicy
impl Copy for RoutePolicy
Source§impl Debug for RoutePolicy
impl Debug for RoutePolicy
Source§impl Display for RoutePolicy
impl Display for RoutePolicy
impl Eq for RoutePolicy
Source§impl Ord for RoutePolicy
impl Ord for RoutePolicy
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RoutePolicy
impl PartialEq for RoutePolicy
Source§impl PartialOrd for RoutePolicy
impl PartialOrd for RoutePolicy
impl StructuralPartialEq for RoutePolicy
Auto Trait Implementations§
impl Freeze for RoutePolicy
impl RefUnwindSafe for RoutePolicy
impl Send for RoutePolicy
impl Sync for RoutePolicy
impl Unpin for RoutePolicy
impl UnsafeUnpin for RoutePolicy
impl UnwindSafe for RoutePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.