Struct re_entity_db::entity_db::EntityDb
source · pub struct EntityDb {
pub data_source: Option<SmartChannelSource>,
/* private fields */
}
Expand description
An in-memory database built from a stream of LogMsg
es.
NOTE: all mutation is to be done via public functions!
Fields§
§data_source: Option<SmartChannelSource>
Implementations§
source§impl EntityDb
impl EntityDb
pub fn new(store_id: StoreId) -> Self
sourcepub fn from_info_and_rows(
store_info: StoreInfo,
rows: impl IntoIterator<Item = DataRow>
) -> Result<Self, Error>
pub fn from_info_and_rows( store_info: StoreInfo, rows: impl IntoIterator<Item = DataRow> ) -> Result<Self, Error>
pub fn tree(&self) -> &EntityTree
pub fn data_store(&self) -> &DataStore
pub fn store_info_msg(&self) -> Option<&SetStoreInfo>
pub fn store_info(&self) -> Option<&StoreInfo>
pub fn app_id(&self) -> Option<&ApplicationId>
pub fn query_caches(&self) -> &Caches
pub fn resolver(&self) -> &PromiseResolver
sourcepub fn latest_at_archetype<A: Archetype>(
&self,
entity_path: &EntityPath,
query: &LatestAtQuery
) -> PromiseResult<Option<((TimeInt, RowId), A)>>where
LatestAtResults: ToArchetype<A>,
pub fn latest_at_archetype<A: Archetype>(
&self,
entity_path: &EntityPath,
query: &LatestAtQuery
) -> PromiseResult<Option<((TimeInt, RowId), A)>>where
LatestAtResults: ToArchetype<A>,
Returns Ok(None)
if any of the required components are missing.
sourcepub fn latest_at_component<C: Component>(
&self,
entity_path: &EntityPath,
query: &LatestAtQuery
) -> Option<LatestAtMonoResult<C>>
pub fn latest_at_component<C: Component>( &self, entity_path: &EntityPath, query: &LatestAtQuery ) -> Option<LatestAtMonoResult<C>>
Get the latest index and value for a given dense re_types_core::Component
.
This assumes that the row we get from the store contains at most one instance for this component; it will log a warning otherwise.
This should only be used for “mono-components” such as Transform
and Tensor
.
This is a best-effort helper, it will merely log errors on failure.
sourcepub fn latest_at_component_quiet<C: Component>(
&self,
entity_path: &EntityPath,
query: &LatestAtQuery
) -> Option<LatestAtMonoResult<C>>
pub fn latest_at_component_quiet<C: Component>( &self, entity_path: &EntityPath, query: &LatestAtQuery ) -> Option<LatestAtMonoResult<C>>
Get the latest index and value for a given dense re_types_core::Component
.
This assumes that the row we get from the store contains at most one instance for this component; it will log a warning otherwise.
This should only be used for “mono-components” such as Transform
and Tensor
.
This is a best-effort helper, and will quietly swallow any errors.
pub fn latest_at_component_at_closest_ancestor<C: Component>( &self, entity_path: &EntityPath, query: &LatestAtQuery ) -> Option<(EntityPath, LatestAtMonoResult<C>)>
pub fn store(&self) -> &DataStore
pub fn store_kind(&self) -> StoreKind
pub fn store_id(&self) -> &StoreId
sourcepub fn cloned_from(&self) -> Option<&StoreId>
pub fn cloned_from(&self) -> Option<&StoreId>
If this entity db is the result of a clone, which store was it cloned from?
A cloned store always gets a new unique ID.
We currently only use entity db cloning for blueprints: when we activate a default blueprint that was received on the wire (e.g. from a recording), we clone it and make the clone the active blueprint. This means all active blueprints are clones.
pub fn timelines(&self) -> impl ExactSizeIterator<Item = &Timeline>
pub fn times_per_timeline(&self) -> &TimesPerTimeline
sourcepub fn time_histogram(&self, timeline: &Timeline) -> Option<&TimeHistogram>
pub fn time_histogram(&self, timeline: &Timeline) -> Option<&TimeHistogram>
Histogram of all events on the timeeline, of all entities.
sourcepub fn num_static_messages(&self) -> u64
pub fn num_static_messages(&self) -> u64
Total number of static messages for any entity.
sourcepub fn is_component_static(
&self,
component_path: &ComponentPath
) -> Option<bool>
pub fn is_component_static( &self, component_path: &ComponentPath ) -> Option<bool>
Returns whether a component is static.
pub fn num_rows(&self) -> usize
sourcepub fn generation(&self) -> StoreGeneration
pub fn generation(&self) -> StoreGeneration
Return the current StoreGeneration
. This can be used to determine whether the
database has been modified since the last time it was queried.
pub fn last_modified_at(&self) -> Instant
sourcepub fn latest_row_id(&self) -> Option<RowId>
pub fn latest_row_id(&self) -> Option<RowId>
The highest RowId
in the store,
which corresponds to the last edit time.
Ignores deletions.
pub fn is_empty(&self) -> bool
sourcepub fn entity_paths(&self) -> Vec<&EntityPath>
pub fn entity_paths(&self) -> Vec<&EntityPath>
A sorted list of all the entity paths in this database.
pub fn ingestion_stats(&self) -> &IngestionStatistics
pub fn entity_path_from_hash( &self, entity_path_hash: &EntityPathHash ) -> Option<&EntityPath>
sourcepub fn is_known_entity(&self, entity_path: &EntityPath) -> bool
pub fn is_known_entity(&self, entity_path: &EntityPath) -> bool
Returns true
also for entities higher up in the hierarchy.
sourcepub fn is_logged_entity(&self, entity_path: &EntityPath) -> bool
pub fn is_logged_entity(&self, entity_path: &EntityPath) -> bool
If you log world/points
, then that is a logged entity, but world
is not,
unless you log something to world
too.
pub fn add(&mut self, msg: &LogMsg) -> Result<(), Error>
pub fn add_data_table(&mut self, table: DataTable) -> Result<(), Error>
sourcepub fn add_data_row(&mut self, row: DataRow) -> Result<(), Error>
pub fn add_data_row(&mut self, row: DataRow) -> Result<(), Error>
Inserts a DataRow
into the database.
Updates the crate::EntityTree
and applies ClearCascade
s as needed.
pub fn set_store_info(&mut self, store_info: SetStoreInfo)
pub fn gc_everything_but_the_latest_row(&mut self)
sourcepub fn purge_fraction_of_ram(&mut self, fraction_to_purge: f32)
pub fn purge_fraction_of_ram(&mut self, fraction_to_purge: f32)
Free up some RAM by forgetting the older parts of all timelines.
pub fn gc(&mut self, gc_options: &GarbageCollectionOptions)
sourcepub fn to_messages(
&self,
time_selection: Option<(Timeline, ResolvedTimeRangeF)>
) -> DataTableResult<Vec<LogMsg>>
pub fn to_messages( &self, time_selection: Option<(Timeline, ResolvedTimeRangeF)> ) -> DataTableResult<Vec<LogMsg>>
Export the contents of the current database to a sequence of messages.
If time_selection
is specified, then only data for that specific timeline over that
specific time range will be accounted for.
Trait Implementations§
source§impl SizeBytes for EntityDb
impl SizeBytes for EntityDb
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreAuto Trait Implementations§
impl !Freeze for EntityDb
impl !RefUnwindSafe for EntityDb
impl Send for EntityDb
impl Sync for EntityDb
impl Unpin for EntityDb
impl !UnwindSafe for EntityDb
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> 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>,
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>
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