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) -> EntityDb
sourcepub fn from_info_and_rows(
store_info: StoreInfo,
rows: impl IntoIterator<Item = DataRow>
) -> Result<EntityDb, Error>
pub fn from_info_and_rows( store_info: StoreInfo, rows: impl IntoIterator<Item = DataRow> ) -> Result<EntityDb, 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 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
pub fn times_per_timeline(&self) -> &TimesPerTimeline
sourcepub fn time_histogram(&self, timeline: &Timeline) -> Option<&Int64Histogram>
pub fn time_histogram(&self, timeline: &Timeline) -> Option<&Int64Histogram>
Histogram of all events on the timeeline, of all entities.
sourcepub fn num_timeless_messages(&self) -> u64
pub fn num_timeless_messages(&self) -> u64
Total number of timeless messages for any entity.
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, TimeRangeF)>
) -> Result<Vec<LogMsg>, DataTableError>
pub fn to_messages( &self, time_selection: Option<(Timeline, TimeRangeF)> ) -> Result<Vec<LogMsg>, DataTableError>
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 DataUi for EntityDb
impl DataUi for EntityDb
source§fn data_ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
verbosity: UiVerbosity,
_query: &LatestAtQuery,
_store: &DataStore
)
fn data_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, verbosity: UiVerbosity, _query: &LatestAtQuery, _store: &DataStore )
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.