pub struct StatisticsManager { /* private fields */ }Expand description
Statistical Information Manager
Centralized management of all statistical information, ensuring thread-safe access.
All statistics are scoped to a space; keys are "{space}.{name}" composite keys.
Implementations§
Source§impl StatisticsManager
impl StatisticsManager
Sourcepub fn mark_space_dirty(&self, space: &str)
pub fn mark_space_dirty(&self, space: &str)
Mark the statistics for space as stale (forces re-collection).
Sourcepub fn invalidate_space(&self, space: Option<&str>)
pub fn invalidate_space(&self, space: Option<&str>)
Invalidate statistics for a space (None = all spaces).
Sourcepub fn space_stamp(&self, space: &str) -> Option<(u64, u64)>
pub fn space_stamp(&self, space: &str) -> Option<(u64, u64)>
The composite (schema_version, data_epoch) stamp for space, if
statistics have been collected for it.
Sourcepub fn space_version(&self, space: &str) -> Option<u64>
pub fn space_version(&self, space: &str) -> Option<u64>
The schema version recorded for space at its last collection, if any.
Sourcepub fn set_space_stamp(&self, space: &str, schema_version: u64, data_epoch: u64)
pub fn set_space_stamp(&self, space: &str, schema_version: u64, data_epoch: u64)
Record the composite stamp at which space was last collected.
Unknown versions (0) are never cached: a zero schema or data
version means cacheability is unknown, so the stamp is not stored
and the next collection always re-samples.
Sourcepub fn register_tag_indexes(
&self,
space: &str,
tag_name: &str,
tag_id: i32,
indexes: Vec<Index>,
)
pub fn register_tag_indexes( &self, space: &str, tag_name: &str, tag_id: i32, indexes: Vec<Index>, )
Register the available indexes for tag_name in space.
Called by the query pipeline when it builds the planning metadata context; registration overwrites any previously registered catalog for the tag, so schema changes are picked up on the next query.
Sourcepub fn get_tag_indexes(
&self,
space: &str,
tag_name: &str,
) -> Option<(i32, Vec<Index>)>
pub fn get_tag_indexes( &self, space: &str, tag_name: &str, ) -> Option<(i32, Vec<Index>)>
The available indexes for tag_name in space, with the tag id.
Sourcepub fn register_tag_id(&self, space: &str, tag_id: i32, tag_name: String)
pub fn register_tag_id(&self, space: &str, tag_id: i32, tag_name: String)
Mapping of registered tag IDs to their corresponding names.
Scoped by space ("{space}:{id}") so tag ids reused across spaces
cannot overwrite each other.
Sourcepub fn get_tag_name_by_id(&self, space: &str, tag_id: i32) -> Option<String>
pub fn get_tag_name_by_id(&self, space: &str, tag_id: i32) -> Option<String>
Retrieve the tag name for a tag ID in a specific space.
Sourcepub fn get_tag_stats_by_id(
&self,
space: &str,
tag_id: i32,
) -> Option<TagStatistics>
pub fn get_tag_stats_by_id( &self, space: &str, tag_id: i32, ) -> Option<TagStatistics>
Retrieve tag statistics based on the tag ID in a specific space.
Sourcepub fn get_vertex_count_by_id(&self, space: &str, tag_id: i32) -> u64
pub fn get_vertex_count_by_id(&self, space: &str, tag_id: i32) -> u64
Get the number of vertices based on the tag ID in a specific space.
Sourcepub fn get_tag_stats(
&self,
space: &str,
tag_name: &str,
) -> Option<TagStatistics>
pub fn get_tag_stats( &self, space: &str, tag_name: &str, ) -> Option<TagStatistics>
Obtain tag statistics information for a specific space.
Sourcepub fn update_tag_stats(&self, space: &str, stats: TagStatistics)
pub fn update_tag_stats(&self, space: &str, stats: TagStatistics)
Update the tag statistics information for a specific space.
Sourcepub fn get_vertex_count(&self, space: &str, tag_name: &str) -> u64
pub fn get_vertex_count(&self, space: &str, tag_name: &str) -> u64
Obtain the number of vertices for a specific space.
Sourcepub fn get_edge_stats(
&self,
space: &str,
edge_type: &str,
) -> Option<EdgeTypeStatistics>
pub fn get_edge_stats( &self, space: &str, edge_type: &str, ) -> Option<EdgeTypeStatistics>
Obtain statistical information about the types of edges for a specific space.
Sourcepub fn update_edge_stats(&self, space: &str, stats: EdgeTypeStatistics)
pub fn update_edge_stats(&self, space: &str, stats: EdgeTypeStatistics)
Update the statistics information on edge types for a specific space.
Sourcepub fn get_edge_count(&self, space: &str, edge_type: &str) -> u64
pub fn get_edge_count(&self, space: &str, edge_type: &str) -> u64
Obtain the number of edges for a specific space.
Sourcepub fn get_property_stats(
&self,
space: &str,
tag_name: Option<&str>,
property_name: &str,
) -> Option<PropertyStatistics>
pub fn get_property_stats( &self, space: &str, tag_name: Option<&str>, property_name: &str, ) -> Option<PropertyStatistics>
Obtain attribute statistics information for a specific space.
Sourcepub fn update_property_stats(&self, space: &str, stats: PropertyStatistics)
pub fn update_property_stats(&self, space: &str, stats: PropertyStatistics)
Update attribute statistics information for a specific space.
Sourcepub fn get_property_combo_stats(
&self,
space: &str,
tag_name: &str,
properties: &[String],
) -> Option<PropertyCombinationStats>
pub fn get_property_combo_stats( &self, space: &str, tag_name: &str, properties: &[String], ) -> Option<PropertyCombinationStats>
Get property combination statistics for GROUP BY cardinality estimation.
Sourcepub fn update_property_combo_stats(
&self,
space: &str,
stats: PropertyCombinationStats,
)
pub fn update_property_combo_stats( &self, space: &str, stats: PropertyCombinationStats, )
Update property combination statistics for a specific space. Existing entries merge via exponential moving average so repeated collections refine rather than replace the estimate.
Sourcepub fn get_combined_cardinality(
&self,
space: &str,
tag_name: Option<&str>,
properties: &[String],
) -> Option<u64>
pub fn get_combined_cardinality( &self, space: &str, tag_name: Option<&str>, properties: &[String], ) -> Option<u64>
Get combined cardinality for a set of properties. Returns None if no statistics are available.
Retrieve all tag names.
Returns bare tag names; space-qualified entries are de-duplicated.
Sourcepub fn get_all_edge_types(&self) -> Vec<String>
pub fn get_all_edge_types(&self) -> Vec<String>
Obtain the names of all edge types (space-qualified entries de-duplicated).
Trait Implementations§
Source§impl Clone for StatisticsManager
impl Clone for StatisticsManager
Source§impl Debug for StatisticsManager
impl Debug for StatisticsManager
Auto Trait Implementations§
impl !RefUnwindSafe for StatisticsManager
impl !UnwindSafe for StatisticsManager
impl Freeze for StatisticsManager
impl Send for StatisticsManager
impl Sync for StatisticsManager
impl Unpin for StatisticsManager
impl UnsafeUnpin for StatisticsManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.