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
impl Gate
Sourcepub fn new(
keys_json: &str,
issuer: &str,
database: &str,
live: Arc<dyn LiveCheck + Send + Sync>,
) -> Result<Self, Error>
pub fn new( keys_json: &str, issuer: &str, database: &str, live: Arc<dyn LiveCheck + Send + Sync>, ) -> Result<Self, Error>
Sourcepub fn with_keys(
keys: KeySet,
issuer: &str,
database: &str,
live: Arc<dyn LiveCheck + Send + Sync>,
) -> Self
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).
Sourcepub fn fetching(
fetch: impl Fn() -> Result<KeySet, Error> + Send + Sync + 'static,
issuer: &str,
database: &str,
live: Arc<dyn LiveCheck + Send + Sync>,
) -> Result<Self>
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.
Sourcepub fn made(&self) -> Arc<Made> ⓘ
pub fn made(&self) -> Arc<Made> ⓘ
What this gate knows was made, for the placer to say when each lands.
Sourcepub fn placed(&self, kind: &str, name: &str, now: u64, placing: bool)
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.
Sourcepub fn present(&self, token: &str, now: u64) -> Result<Value, Failure>
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.
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.
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.
Sourcepub fn run_drafts(
&self,
service: &Service,
token: Option<&str>,
after: Option<&str>,
) -> Result<Value, Failure>
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.