pub struct AuthzEngine { /* private fields */ }Expand description
The main authorization engine
Implementations§
Source§impl AuthzEngine
impl AuthzEngine
Sourcepub fn bloom_stats(&self) -> BloomStats
pub fn bloom_stats(&self) -> BloomStats
Get the Bloom filter statistics
Sourcepub fn bloom_filter(&self) -> &AuthzBloomFilter
pub fn bloom_filter(&self) -> &AuthzBloomFilter
Get a reference to the Bloom filter
Sourcepub async fn write_tuple(&self, tuple: RelationTuple) -> Result<()>
pub async fn write_tuple(&self, tuple: RelationTuple) -> Result<()>
Write a relation tuple
Sourcepub async fn delete_tuple(&self, tuple: RelationTuple) -> Result<()>
pub async fn delete_tuple(&self, tuple: RelationTuple) -> Result<()>
Delete a relation tuple
Sourcepub async fn check(&self, request: CheckRequest) -> Result<CheckResponse>
pub async fn check(&self, request: CheckRequest) -> Result<CheckResponse>
Check if a subject has a relation to an object
Sourcepub async fn expand(&self, request: ExpandRequest) -> Result<ExpandResponse>
pub async fn expand(&self, request: ExpandRequest) -> Result<ExpandResponse>
Expand a relation to find all subjects
Sourcepub async fn batch_check(
&self,
requests: &[CheckRequest],
) -> Result<Vec<CheckResponse>>
pub async fn batch_check( &self, requests: &[CheckRequest], ) -> Result<Vec<CheckResponse>>
Batch check multiple authorization requests efficiently
This method uses Bloom filter to skip definitely non-existent tuples and PostgreSQL ANY() for efficient batch queries.
Performance targets:
- 100 checks: <50ms total
- Bloom filter reduces DB queries by ~50%
Sourcepub async fn warm_bloom_filter(&self) -> Result<usize>
pub async fn warm_bloom_filter(&self) -> Result<usize>
Load existing tuples into the Bloom filter (for warm-up)
Auto Trait Implementations§
impl Freeze for AuthzEngine
impl !RefUnwindSafe for AuthzEngine
impl Send for AuthzEngine
impl Sync for AuthzEngine
impl Unpin for AuthzEngine
impl !UnwindSafe for AuthzEngine
Blanket Implementations§
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> 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