Skip to main content

PostgresZanzibarStore

Struct PostgresZanzibarStore 

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

Postgres-backed Zanzibar store. Cheap to clone (the underlying PgPool is Arc internally).

Implementations§

Source§

impl PostgresZanzibarStore

Source

pub fn new(pool: PgPool) -> Self

Source

pub fn into_dyn(self) -> Arc<dyn ZanzibarStore>

Wrap into an Arc<dyn ZanzibarStore> for crate::ctx::AuthCtx.

Trait Implementations§

Source§

impl Clone for PostgresZanzibarStore

Source§

fn clone(&self) -> PostgresZanzibarStore

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ZanzibarStore for PostgresZanzibarStore

Source§

fn define_namespace<'life0, 'life1, 'async_trait>( &'life0 self, schema: &'life1 NamespaceSchema, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist (or replace) a namespace’s schema. Idempotent — caller may freely re-apply the same schema; a no-op insert/update is fine.
Source§

fn get_namespace<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<NamespaceSchema>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a namespace’s schema by name. Ok(None) if not yet defined — callers (typically check) treat that as a hard “deny” since the relation set can’t be resolved.
Source§

fn list_namespaces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<NamespaceSchema>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List every namespace, ordered by name. Used by admin UI.
Source§

fn write_tuple<'life0, 'life1, 'async_trait>( &'life0 self, t: &'life1 Tuple, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert one tuple. Idempotent on the composite PK — re-writing the same tuple is a no-op (returns Ok(()) without erroring).
Source§

fn write_tuples<'life0, 'life1, 'async_trait>( &'life0 self, tuples: &'life1 [Tuple], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomic batch write. Either every tuple is persisted or none are. Used by the admin “import schema + seed tuples” workflows.
Source§

fn delete_tuple<'life0, 'life1, 'async_trait>( &'life0 self, t: &'life1 Tuple, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete one tuple by exact match. Returns Ok(true) iff a row was removed.
Source§

fn check<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, resource: &'life1 ObjectRef, permission: &'life2 str, subject: &'life3 SubjectRef, _consistency: Consistency, ) -> Pin<Box<dyn Future<Output = Result<CheckResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Permission check. Walks the tuple DAG from resource along every relation that resolves to permission per the namespace schema, looking for subject. Read more
Source§

fn expand<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, resource: &'life1 ObjectRef, relation: &'life2 str, depth_limit: u32, ) -> Pin<Box<dyn Future<Output = Result<UsersetTree>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Userset-rewrite expansion — returns the tree of subjects that satisfy relation on resource. Bounded by depth_limit to match the check walk’s depth bound (caller passes super::types::MAX_DEPTH in production).
Source§

fn lookup_resources<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, resource_type: &'life1 str, permission: &'life2 str, subject: &'life3 SubjectRef, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectRef>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Forward index — find every (resource_type, *) where subject has permission. Used to populate UI lists like “every document Alice can view”.
Source§

fn lookup_subjects<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, subject_type: &'life1 str, resource: &'life2 ObjectRef, permission: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectRef>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Reverse index — find every subject of type subject_type that has permission on resource. Used to populate UI lists like “every viewer of doc X”.

Auto Trait Implementations§

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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: 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: 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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

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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,