pub struct ConcurrentGraph { /* private fields */ }Expand description
A concurrent, lock-free graph implementation
Implementations§
Source§impl ConcurrentGraph
impl ConcurrentGraph
Sourcepub fn insert(&self, triple: Triple) -> Result<bool, OxirsError>
pub fn insert(&self, triple: Triple) -> Result<bool, OxirsError>
Insert a triple into the graph (lock-free)
Sourcepub fn remove(&self, triple: &Triple) -> Result<bool, OxirsError>
pub fn remove(&self, triple: &Triple) -> Result<bool, OxirsError>
Remove a triple from the graph (lock-free)
Sourcepub fn iter(&self) -> impl Iterator<Item = Triple> + '_
pub fn iter(&self) -> impl Iterator<Item = Triple> + '_
Iterate over all triples (wait-free snapshot)
Sourcepub fn match_pattern(
&self,
subject: Option<&Subject>,
predicate: Option<&Predicate>,
object: Option<&Object>,
) -> Vec<Triple>
pub fn match_pattern( &self, subject: Option<&Subject>, predicate: Option<&Predicate>, object: Option<&Object>, ) -> Vec<Triple>
Find triples matching a pattern (wait-free)
Sourcepub fn stats(&self) -> GraphStats
pub fn stats(&self) -> GraphStats
Get statistics about the graph
Source§impl ConcurrentGraph
Batch operations for improved performance
impl ConcurrentGraph
Batch operations for improved performance
Sourcepub fn insert_batch(&self, triples: Vec<Triple>) -> Result<usize, OxirsError>
pub fn insert_batch(&self, triples: Vec<Triple>) -> Result<usize, OxirsError>
Insert multiple triples in a batch
For small batches (<100), uses sequential insertion. For large batches, uses parallel insertion with concurrent index updates.
Sourcepub fn remove_batch(&self, triples: &[Triple]) -> Result<usize, OxirsError>
pub fn remove_batch(&self, triples: &[Triple]) -> Result<usize, OxirsError>
Remove multiple triples in a batch
For small batches (<100), uses sequential removal. For large batches, uses parallel removal with concurrent index updates.
Sourcepub fn rebuild_indices(&self) -> Result<(), OxirsError>
pub fn rebuild_indices(&self) -> Result<(), OxirsError>
Rebuild all indices from scratch (useful for optimization after many operations)
This operation is expensive but can improve query performance by defragmenting the index structures and removing empty entries.
Sourcepub fn clear(&self) -> Result<(), OxirsError>
pub fn clear(&self) -> Result<(), OxirsError>
Clear all triples from the graph
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConcurrentGraph
impl !RefUnwindSafe for ConcurrentGraph
impl Send for ConcurrentGraph
impl Sync for ConcurrentGraph
impl Unpin for ConcurrentGraph
impl UnsafeUnpin for ConcurrentGraph
impl !UnwindSafe for ConcurrentGraph
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
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>
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>
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