Struct exocore_store::local::EntityIndex [−][src]
pub struct EntityIndex<CS, PS> where
CS: ChainStore,
PS: PendingStore, { /* fields omitted */ }
Expand description
Manages and index entities and their traits stored in the chain and pending store of the chain layer. The index accepts mutations from the chain layer through its event stream, and manages both indices to be consistent.
The chain index is persisted on disk, while the pending store index is an in-memory index. Since the persistence in the chain is not definitive until blocks and their operations (entity mutations) are stored at a certain depth, a part of the chain is actually indexed in the in-memory index. Once they reach a certain depth, they are persisted in the chain index.
Implementations
pub fn open_or_create(
cell: FullCell,
config: EntityIndexConfig,
chain_handle: EngineHandle<CS, PS>,
clock: Clock
) -> Result<EntityIndex<CS, PS>, Error>
pub fn open_or_create(
cell: FullCell,
config: EntityIndexConfig,
chain_handle: EngineHandle<CS, PS>,
clock: Clock
) -> Result<EntityIndex<CS, PS>, Error>
Opens or create an entities index
pub fn handle_chain_engine_event(
&mut self,
event: Event
) -> Result<(Vec<OperationId>, usize), Error>
Handles events coming from the chain layer. These events allow keeping the index consistent with the chain layer, up to the consistency guarantees that the layer offers. Returns operations that have been involved and the number of index operations applied.
Since the events stream is buffered, we may receive a discontinuity if the chain layer couldn’t send us an event. In that case, we re-index the pending index since we can’t guarantee that we didn’t lose an event.
Executes a search query on the indices, and returning all entities matching the query.
Calls the garbage collector to run a pass on entities that got flagged and generates deletion mutations.
pub fn fetch_aggregated_entity_mutations(
&self,
entity_id: &str
) -> Result<EntityAggregator, Error>
pub fn fetch_aggregated_entity_mutations(
&self,
entity_id: &str
) -> Result<EntityAggregator, Error>
Fetches indexed mutations metadata from pending and chain indices for this entity id and aggregate them.
Auto Trait Implementations
impl<CS, PS> !RefUnwindSafe for EntityIndex<CS, PS>
impl<CS, PS> Send for EntityIndex<CS, PS>
impl<CS, PS> Sync for EntityIndex<CS, PS>
impl<CS, PS> Unpin for EntityIndex<CS, PS>
impl<CS, PS> !UnwindSafe for EntityIndex<CS, PS>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more