Skip to main content

Gate

Struct Gate 

Source
pub struct Gate { /* private fields */ }
Expand description

A served haematite’s Lys gate: the keys, issuer and database id it decides every request against, and the live check deliberate routes ask.

Implementations§

Source§

impl Gate

Source

pub fn new( keys_json: &str, issuer: &str, database: &str, live: Arc<dyn LiveCheck + Send + Sync>, ) -> Result<Self, Error>

A gate for the served database database, trusting issuer and the keys it publishes as keys_json.

§Errors

Returns Error when the published keyset does not validate whole.

Source

pub fn with_keys( keys: KeySet, issuer: &str, database: &str, live: Arc<dyn LiveCheck + Send + Sync>, ) -> Self

A gate trusting keys, as read from issuer (/oauth/jwks).

Source

pub fn fetching( fetch: impl Fn() -> Result<KeySet, Error> + Send + Sync + 'static, issuer: &str, database: &str, live: Arc<dyn LiveCheck + Send + Sync>, ) -> Result<Self>

A gate for database trusting issuer, listening before its keys are read: fetch asks Lys for them on a thread of its own, again after every failure, waiting from [KEYS_RETRY_FIRST] doubled up to [KEYS_RETRY_MOST], until they are read or the gate is dropped. Until then every decided act is refused as LYS_KEYS_PENDING.

§Errors

Returns the operating system’s error when the thread cannot start.

Source

pub fn made(&self) -> Arc<Made> ⓘ

What this gate knows was made, for the placer to say when each lands.

Source

pub fn placed(&self, kind: &str, name: &str, now: u64, placing: bool)

A collection or branch named name (its Lys kind kind) was made by a write that committed at now; placing when a placer will place it and say so. What was made a day before is let go.

Source

pub fn present(&self, token: &str, now: u64) -> Result<Value, Failure>

Verify a presented pass and answer whose it is and when it expires.

§Errors

Returns the pass’s refusal by its stable name.

Source

pub fn authorize( &self, token: Option<&str>, operation: &Operation, words: Option<&str>, now: u64, ) -> Result<Vec<String>, Failure>

Decide every subject of operation from the connection’s pass token, answering the grants that permit it, one per subject (D11). words are the request’s exact text, which a held change is drafted with.

§Errors

Returns the first refusal: permission_refused carrying the one refusal shape, held_for_approval for a grant held by draft or by two, or the pass’s or Lys’s stable name.

Source

pub fn authorize_with( &self, token: Option<&str>, operation: &Operation, words: Option<&str>, now: u64, absent: &dyn Fn(&str, &str) -> bool, ) -> Result<Vec<String>, Failure>

Gate::authorize, where absent(kind, name) answers whether the store holds no such branch, or no such collection on the change’s branch. Lys places only what exists, so a pass carries no right on what does not: a hot act refused on it is decided by the same right on the database, the right it would inherit, and the store then answers branch_missing or collection_missing.

§Errors

As Gate::authorize.

Source

pub fn run_drafts( &self, service: &Service, token: Option<&str>, after: Option<&str>, ) -> Result<Value, Failure>

Run one page of the drafts Lys approved for this gate’s database, applied to service, with the connection’s pass token as the connector’s. The route was decided before this, as drafts.run.

§Errors

pass_missing without a pass, or where the run stopped, by name: a change applied but not acknowledged keeps its receipt, and the next run answers it again without applying it twice.

Auto Trait Implementations§

§

impl !Freeze for Gate

§

impl !RefUnwindSafe for Gate

§

impl !UnwindSafe for Gate

§

impl Send for Gate

§

impl Sync for Gate

§

impl Unpin for Gate

§

impl UnsafeUnpin for Gate

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more