timeseries_table_format/
table.rs1mod error;
7mod operations;
8
9pub use operations::append;
10pub use operations::{
11 AppendError, CoverageQueryError, CreateTableError, OpenTableError, OptimizeError,
12 OptimizeReport, ScanError, TableStateAccessError,
13};
14
15#[cfg(test)]
16pub(crate) mod test_util;
17
18#[cfg(test)]
19mod latest_snapshot_tests;
20
21use std::pin::Pin;
22
23use arrow::array::RecordBatch;
24use futures::Stream;
25
26use crate::{
27 metadata::protocol::TableProtocolError,
28 storage::TableLocation,
29 transaction_log::{IndexSpec, TableState, TransactionLogStore},
30};
31
32pub use crate::formats::parquet::EntityRewriteError;
33pub use error::TableError;
34
35pub type TimeSeriesScan = Pin<Box<dyn Stream<Item = Result<RecordBatch, TableError>> + Send>>;
39
40#[derive(Debug, Clone)]
45pub struct TimeSeriesTable {
46 log: TransactionLogStore,
47 state: TableState,
48 index: IndexSpec,
49}
50
51impl TimeSeriesTable {
52 pub fn state(&self) -> &TableState {
54 &self.state
55 }
56
57 #[allow(dead_code)]
59 pub(crate) fn state_mut(&mut self) -> &mut TableState {
60 &mut self.state
61 }
62
63 pub fn index_spec(&self) -> &IndexSpec {
65 &self.index
66 }
67
68 pub fn location(&self) -> &TableLocation {
70 self.log.location()
71 }
72
73 pub(crate) fn ensure_write_compatible(&self) -> Result<(), TableProtocolError> {
74 self.state.table_meta.ensure_write_compatible()
75 }
76}