Skip to main content

Ctx

Struct Ctx 

Source
pub struct Ctx<'a, S: StorageAdapter> {
    pub storage: &'a S,
    pub snapshot: &'a SchemaSnapshot,
    pub scope: &'a AclScope,
    pub options: &'a PermissionOptions,
    pub is_maintenance: bool,
}
Expand description

Everything one request carries into every stage.

The snapshot is taken once and threaded down, so a batch cannot evaluate half its work under one schema and half under another.

Fields§

§storage: &'a S§snapshot: &'a SchemaSnapshot§scope: &'a AclScope§options: &'a PermissionOptions§is_maintenance: bool

Whether this request authenticated with the maintenance key rather than the master key.

AclScope::Unrestricted covers both, because they apply the same ACL treatment: none. But they are not the same authority, and at least one decision reads them differently. validateClientClassCreation exempts master and maintenance on a write (RestWrite.js:200-202) and only master on a read (RestQuery.js:486-489), so the read path needs to tell them apart and the scope cannot.

A separate flag rather than an AclScope variant, deliberately and narrowly: a variant would force a master-versus-maintenance judgment at all twenty-five Unrestricted sites, and only this one is known to differ. The general conflation is recorded in the deliberate differences in CHANGELOG.md; this closes the case that is known to be wrong rather than pretending to close the rest.

Implementations§

Source§

impl<'a, S: StorageAdapter> Ctx<'a, S>

Source

pub fn new( storage: &'a S, snapshot: &'a SchemaSnapshot, scope: &'a AclScope, options: &'a PermissionOptions, ) -> Self

Source

pub fn maintenance(self, yes: bool) -> Self

Mark the request as maintenance-key authenticated.

Defaults to false so the forty-odd Ctx::new call sites, nearly all of them tests, keep their signature: a test that does not care about the distinction cannot get it wrong.

Auto Trait Implementations§

§

impl<'a, S> Freeze for Ctx<'a, S>

§

impl<'a, S> RefUnwindSafe for Ctx<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for Ctx<'a, S>

§

impl<'a, S> Sync for Ctx<'a, S>

§

impl<'a, S> Unpin for Ctx<'a, S>

§

impl<'a, S> UnsafeUnpin for Ctx<'a, S>

§

impl<'a, S> UnwindSafe for Ctx<'a, S>
where S: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V