pub struct HypertableSpec {
pub name: String,
pub time_column: String,
pub chunk_interval_ns: u64,
pub default_ttl_ns: Option<u64>,
}Expand description
Spec declared by CREATE HYPERTABLE.
Fields§
§name: String§time_column: StringColumn name that carries the time axis (must be unix-ns BIGINT or parseable to one).
chunk_interval_ns: u64Fixed width of a single chunk, in nanoseconds.
default_ttl_ns: Option<u64>Default TTL applied to every new chunk when the DDL didn’t
request an explicit override. None means “no TTL — chunks
live until explicit drop_chunks / retention policy fires”.
The effective expiry of a chunk is max_ts_ns + ttl_ns, so
a chunk is safely droppable once now_ns ≥ expiry. That
matches the contract callers already learnt from the
retention daemon — partition TTL is the declarative way
to say the same thing at CREATE time without a separate
add_retention_policy call.
Implementations§
Source§impl HypertableSpec
impl HypertableSpec
pub fn new( name: impl Into<String>, time_column: impl Into<String>, chunk_interval_ns: u64, ) -> Self
Sourcepub fn from_interval_string(
name: impl Into<String>,
time_column: impl Into<String>,
interval: &str,
) -> Option<Self>
pub fn from_interval_string( name: impl Into<String>, time_column: impl Into<String>, interval: &str, ) -> Option<Self>
Convenience: construct from a Timescale-style duration string
("1d", "1h", "30m"…).
Sourcepub fn with_ttl(self, ttl: &str) -> Option<Self>
pub fn with_ttl(self, ttl: &str) -> Option<Self>
Builder-style: attach a default TTL. Uses the same duration
grammar as chunk_interval ("90d", "30s", …).
Sourcepub fn with_ttl_ns(self, ttl_ns: u64) -> Self
pub fn with_ttl_ns(self, ttl_ns: u64) -> Self
Direct setter when the TTL is already computed in ns.
Sourcepub fn chunk_start(&self, timestamp_ns: u64) -> u64
pub fn chunk_start(&self, timestamp_ns: u64) -> u64
Align timestamp_ns to the chunk’s floor — the chunk that
row belongs to starts at this timestamp and covers
[start, start + chunk_interval_ns).
pub fn chunk_end_exclusive(&self, timestamp_ns: u64) -> u64
Trait Implementations§
Source§impl Clone for HypertableSpec
impl Clone for HypertableSpec
Source§fn clone(&self) -> HypertableSpec
fn clone(&self) -> HypertableSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HypertableSpec
impl RefUnwindSafe for HypertableSpec
impl Send for HypertableSpec
impl Sync for HypertableSpec
impl Unpin for HypertableSpec
impl UnsafeUnpin for HypertableSpec
impl UnwindSafe for HypertableSpec
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request