pub struct IndexedJournalHandler { /* private fields */ }Expand description
Production indexed journal handler
Provides efficient O(log n) lookups using B-tree indexes, O(1) membership testing using Bloom filters, and cryptographic verification or integrity using Merkle trees.
§Performance Guarantees
facts_by_predicate: O(log n + k) where k is result sizefacts_by_authority: O(log n + k) where k is result sizefacts_in_range: O(log n + k) where k is result sizemight_contain: O(1) with <1% false positive ratemerkle_root: O(n) on first call, O(1) cachedverify_fact_inclusion: O(log n)
§Concurrency Model
Uses parking_lot::RwLock for synchronous locking of the state bundle.
Each operation acquires and releases the lock in sub-millisecond time.
See module documentation for scale expectations and alternatives.
Implementations§
Source§impl IndexedJournalHandler
impl IndexedJournalHandler
Sourcepub fn with_capacity(expected_elements: u64) -> Self
pub fn with_capacity(expected_elements: u64) -> Self
Create a new indexed journal handler with specified expected capacity
Trait Implementations§
Source§impl Debug for IndexedJournalHandler
impl Debug for IndexedJournalHandler
Source§impl Default for IndexedJournalHandler
impl Default for IndexedJournalHandler
Source§impl IndexedJournalEffects for IndexedJournalHandler
impl IndexedJournalEffects for IndexedJournalHandler
Source§fn watch_facts(&self) -> Box<dyn FactStreamReceiver>
fn watch_facts(&self) -> Box<dyn FactStreamReceiver>
Subscribe to journal fact updates as they are added. Read more
Source§fn facts_by_predicate<'life0, 'life1, 'async_trait>(
&'life0 self,
predicate: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn facts_by_predicate<'life0, 'life1, 'async_trait>(
&'life0 self,
predicate: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get all facts with the given predicate/key. Read more
Get all facts created by the given authority. Read more
Source§fn facts_in_range<'life0, 'async_trait>(
&'life0 self,
start: TimeStamp,
end: TimeStamp,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn facts_in_range<'life0, 'async_trait>(
&'life0 self,
start: TimeStamp,
end: TimeStamp,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all facts within the given time range (inclusive). Read more
Source§fn all_facts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn all_facts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<IndexedFact>, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return all indexed facts (append-only view).
Source§fn might_contain(&self, predicate: &str, value: &FactValue) -> bool
fn might_contain(&self, predicate: &str, value: &FactValue) -> bool
Fast membership test using Bloom filter. Read more
Source§fn merkle_root<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn merkle_root<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the Merkle root commitment for the current index state. Read more
Source§fn verify_fact_inclusion<'life0, 'life1, 'async_trait>(
&'life0 self,
fact: &'life1 IndexedFact,
) -> Pin<Box<dyn Future<Output = Result<bool, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn verify_fact_inclusion<'life0, 'life1, 'async_trait>(
&'life0 self,
fact: &'life1 IndexedFact,
) -> Pin<Box<dyn Future<Output = Result<bool, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify a fact against the Merkle tree. Read more
Source§fn get_bloom_filter<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BloomFilter, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_bloom_filter<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BloomFilter, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the Bloom filter for fast membership tests. Read more
Source§fn index_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IndexStats, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn index_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IndexStats, AuraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get statistics about the index.
Auto Trait Implementations§
impl !Freeze for IndexedJournalHandler
impl !RefUnwindSafe for IndexedJournalHandler
impl Send for IndexedJournalHandler
impl Sync for IndexedJournalHandler
impl Unpin for IndexedJournalHandler
impl UnsafeUnpin for IndexedJournalHandler
impl !UnwindSafe for IndexedJournalHandler
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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 moreSource§impl<T> IntoViewDelta for T
impl<T> IntoViewDelta for T
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.