pub struct PostgresZanzibarStore { /* private fields */ }Expand description
Postgres-backed Zanzibar store. Cheap to clone (the underlying
PgPool is Arc internally).
Implementations§
Source§impl PostgresZanzibarStore
impl PostgresZanzibarStore
pub fn new(pool: PgPool) -> Self
Sourcepub fn into_dyn(self) -> Arc<dyn ZanzibarStore>
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
impl Clone for PostgresZanzibarStore
Source§fn clone(&self) -> PostgresZanzibarStore
fn clone(&self) -> PostgresZanzibarStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ZanzibarStore for PostgresZanzibarStore
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,
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,
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,
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,
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,
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,
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,
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 moreSource§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,
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,
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,
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§
impl Freeze for PostgresZanzibarStore
impl !RefUnwindSafe for PostgresZanzibarStore
impl Send for PostgresZanzibarStore
impl Sync for PostgresZanzibarStore
impl Unpin for PostgresZanzibarStore
impl UnsafeUnpin for PostgresZanzibarStore
impl !UnwindSafe for PostgresZanzibarStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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