Skip to main content

StatisticsMaintenance

Struct StatisticsMaintenance 

Source
pub struct StatisticsMaintenance { /* private fields */ }
Expand description

Transactional maintenance metadata. Existing column statistics remain available while this record tracks changes awaiting a replacement.

Implementations§

Source§

impl StatisticsMaintenance

Source

pub const KEY_PREFIX: &'static str = "uqa.statistics.maintenance.v1:"

Source

pub fn key(table: &str) -> String

Source

pub fn load( catalog: &dyn CatalogFacade, table: &str, ) -> StorageBackendResult<Self>

Source

pub fn load_for( catalog: &dyn CatalogFacade, table: &str, object_id: [u8; 16], ) -> StorageBackendResult<Self>

Source

pub fn save( &self, catalog: &dyn CatalogFacade, table: &str, ) -> StorageBackendResult<()>

Source

pub fn dirty(&self) -> bool

Source

pub fn missing(&self, statistics_empty: bool) -> bool

Source

pub fn invalidates_existing_statistics(&self) -> bool

Source

pub fn due(&self, missing: bool, now: u64, statistics_format: u32) -> bool

Source

pub fn defers(&self, unrecorded: u64, now: u64) -> bool

Whether a session may keep unrecorded changes of its commits to itself instead of recording them now. A record written by every commit is a write of two records to each of them, and the count decides only when an analysis becomes due, so a session records the changes that decide something: the first one after an analysis, which marks the statistics stale and starts their age, and the ones that make an analysis due. Otherwise it keeps up to a quarter of what makes one due, or sixteen changes of a small table, which bounds what sessions hide from one another and what a session loses when it ends. While an analysis is due already, more changes decide nothing.

Source

pub fn analyzed_for( catalog: &dyn CatalogFacade, table: &str, object_id: [u8; 16], rows: u64, statistics_format: u32, sampled_at: Option<u64>, ) -> StorageBackendResult<()>

Source

pub fn analyzed( &mut self, object_id: [u8; 16], rows: u64, statistics_format: u32, sampled_at: Option<u64>, ) -> StorageBackendResult<()>

Record a completed analysis of rows rows, which covers every change counted before it. sampled_at is the commit sequence its sample read at, or None when that is not known.

Source

pub fn covers(&self, through: Option<u64>) -> bool

Whether the last analysis sampled every commit up to through, so that changes a session kept of commits up to there need no counting.

Source

pub fn same_analysis(&self, other: &Self) -> bool

Row changes retain the last statistics publication; another analysis replaces it even when the resulting estimates happen to be identical.

Source

pub fn merge_sample( &self, before: &Self, current: &Self, data_changed: bool, now: u64, ) -> StorageBackendResult<Option<Self>>

Publish this sample’s reset over changes recorded since before. The caller must first verify that the relation and its last statistics publication still have the captured identities. A changed data generation can also represent writes retained privately by their sessions: keep one pending change in that case so their absence from the counter cannot mark the sampled statistics current. The counter is a maintenance estimate.

Source

pub fn record_changes( &mut self, object_id: [u8; 16], count: u64, previous_rows: Option<u64>, now: u64, ) -> StorageBackendResult<()>

Source

pub fn encode( &self, control: &StorageReadControl, ) -> VersionResult<BudgetedVec<u8>>

Encode the fixed-size state under the same budget and cancellation control as its record.

Trait Implementations§

Source§

impl Clone for StatisticsMaintenance

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StatisticsMaintenance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StatisticsMaintenance

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StatisticsMaintenance

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StatisticsMaintenance

Source§

impl PartialEq for StatisticsMaintenance

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for StatisticsMaintenance

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StatisticsMaintenance

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.