pub struct LeopardIndex { /* private fields */ }Expand description
Leopard reachability index
Implementations§
Source§impl LeopardIndex
impl LeopardIndex
Sourcepub fn new(namespace_configs: Arc<HashMap<String, NamespaceConfig>>) -> Self
pub fn new(namespace_configs: Arc<HashMap<String, NamespaceConfig>>) -> Self
Create a new Leopard index
Sourcepub fn with_config(
namespace_configs: Arc<HashMap<String, NamespaceConfig>>,
config: LeopardConfig,
) -> Self
pub fn with_config( namespace_configs: Arc<HashMap<String, NamespaceConfig>>, config: LeopardConfig, ) -> Self
Create a new Leopard index with custom configuration
Sourcepub async fn index_tuple(&self, tuple: &RelationTuple) -> Result<usize>
pub async fn index_tuple(&self, tuple: &RelationTuple) -> Result<usize>
Index a new tuple and compute transitive closures
Sourcepub async fn remove_tuple(&self, tuple: &RelationTuple) -> Result<usize>
pub async fn remove_tuple(&self, tuple: &RelationTuple) -> Result<usize>
Remove a tuple and its computed entries from the index
Sourcepub async fn check(&self, request: &CheckRequest) -> Option<bool>
pub async fn check(&self, request: &CheckRequest) -> Option<bool>
Check if a subject has a relation (O(1) lookup)
Sourcepub async fn expand(
&self,
namespace: &str,
object_id: &str,
relation: &str,
) -> Vec<String>
pub async fn expand( &self, namespace: &str, object_id: &str, relation: &str, ) -> Vec<String>
Get all subjects with a specific relation to an object
Sourcepub async fn list_subject_access(
&self,
subject: &Subject,
) -> Vec<(String, String, String)>
pub async fn list_subject_access( &self, subject: &Subject, ) -> Vec<(String, String, String)>
Get all relations a subject has to objects
Sourcepub async fn stats(&self) -> LeopardStats
pub async fn stats(&self) -> LeopardStats
Get statistics
Sourcepub async fn bulk_load(&self, tuples: &[RelationTuple]) -> Result<usize>
pub async fn bulk_load(&self, tuples: &[RelationTuple]) -> Result<usize>
Bulk load tuples into the index
Auto Trait Implementations§
impl Freeze for LeopardIndex
impl !RefUnwindSafe for LeopardIndex
impl Send for LeopardIndex
impl Sync for LeopardIndex
impl Unpin for LeopardIndex
impl !UnwindSafe for LeopardIndex
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