Skip to main content

TimeSeriesTable

Struct TimeSeriesTable 

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

High-level time-series table handle.

This is the main entry point for callers. It bundles:

  • where the table is,
  • how to talk to the transaction log,
  • what the current committed state is,
  • and the extracted time index spec.

Implementations§

Source§

impl TimeSeriesTable

Source

pub async fn append_parquet_segment( &mut self, relative_path: &str, time_column: &str, ) -> Result<u64, TableError>

Append a Parquet segment using its canonical relative path as identity.

Source

pub async fn append_parquet_segment_with_report( &mut self, relative_path: &str, time_column: &str, ) -> Result<(u64, AppendReport), TableError>

Append a Parquet segment and return a profiling report.

Source§

impl TimeSeriesTable

Source

pub async fn load_table_coverage_snapshot_only( &self, ) -> Result<Coverage, TableError>

Load table coverage using the snapshot pointer only.

  • If there is no snapshot pointer:
    • If table has zero segments: returns empty coverage.
    • Else: returns MissingTableCoveragePointer (strict mode).
  • If snapshot exists but is missing/corrupt: returns the snapshot read error.
Source§

impl TimeSeriesTable

Source

pub async fn coverage_ratio_for_range( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<f64, TableError>

Coverage ratio in [0.0, 1.0] for the half-open time range [start, end).

Uses the table-level coverage snapshot (with readonly recovery from segments if needed).

§Errors
§Examples
use chrono::{TimeZone, Utc};
let start = Utc.timestamp_opt(0, 0).single().unwrap();
let end = Utc.timestamp_opt(120, 0).single().unwrap();
let ratio = table.coverage_ratio_for_range(start, end).await?;
Source

pub async fn max_gap_len_for_range( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<u64, TableError>

Maximum contiguous missing run length (in buckets) for the half-open time range [start, end).

§Errors
§Examples
use chrono::{TimeZone, Utc};
let start = Utc.timestamp_opt(0, 0).single().unwrap();
let end = Utc.timestamp_opt(180, 0).single().unwrap();
let gap = table.max_gap_len_for_range(start, end).await?;
Source

pub async fn last_fully_covered_window( &self, ts_end: DateTime<Utc>, window_len_buckets: u64, ) -> Result<Option<RangeInclusive<Bucket>>, TableError>

Return the last fully covered contiguous window (in bucket space) of length >= window_len_buckets, ending at or before ts_end.

Notes:

  • This returns a bucket-id RangeInclusive in the v0.1 bucket domain (u32).
  • Returns None when window_len_buckets == 0 or when no fully covered window is found.
§Errors
§Examples
use chrono::{TimeZone, Utc};
let ts_end = Utc.timestamp_opt(360, 0).single().unwrap(); // end of bucket 5
let window = table.last_fully_covered_window(ts_end, 2).await?;
Source§

impl TimeSeriesTable

Source

pub async fn scan_range( &self, ts_start: DateTime<Utc>, ts_end: DateTime<Utc>, ) -> Result<TimeSeriesScan, TableError>

Scan the time-series table for record batches overlapping [ts_start, ts_end), returning a stream of filtered batches from the segments covering that range.

Source§

impl TimeSeriesTable

Source

pub fn state(&self) -> &TableState

Return the current committed table state.

Source

pub fn index_spec(&self) -> &TimeIndexSpec

Return the time index specification for this table.

Source

pub fn location(&self) -> &TableLocation

Return the table location.

Source

pub async fn open(location: TableLocation) -> Result<Self, TableError>

Open an existing time-series table at the given location.

Steps:

  • Build a TransactionLogStore for the location.
  • Rebuild TableState from the transaction log.
  • Reject empty tables (version == 0).
  • Require TableKind::TimeSeries and extract TimeIndexSpec.
Source

pub async fn create( location: TableLocation, table_meta: TableMeta, ) -> Result<Self, TableError>

Create a new time-series table at the given location.

This:

  • Requires table_meta.format_version to match TABLE_FORMAT_VERSION,
  • Requires table_meta.kind to be TableKind::TimeSeries,
  • Verifies that there are no existing commits (version must be 0),
  • Writes an initial commit with UpdateTableMeta(table_meta.clone()),
  • Returns a TimeSeriesTable with a fresh TableState.
Source

pub async fn current_version(&self) -> Result<u64, TableError>

Load the current log version from disk without mutating in-memory state.

Source

pub async fn load_latest_state(&self) -> Result<TableState, TableError>

Rebuild and return the latest table state from the transaction log.

Source

pub async fn refresh(&mut self) -> Result<bool, TableError>

Refresh in-memory state if the log has advanced; returns true if updated.

Trait Implementations§

Source§

impl Clone for TimeSeriesTable

Source§

fn clone(&self) -> TimeSeriesTable

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 TimeSeriesTable

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V