Skip to main content

Sealed

Struct Sealed 

Source
pub struct Sealed {
    pub tables: Vec<(&'static str, RecordBatch)>,
    pub sidecars: Vec<(&'static str, Vec<u8>)>,
    pub min_ts: i64,
    pub max_ts: i64,
    pub num_rows: usize,
}
Expand description

A block’s worth of rows, sealed and ready for crate::block::publish.

The table names are the file stems inside the published directory (logs.arrow, log_attrs.arrow, …), so they are part of the on-disk format and not a display detail.

Fields§

§tables: Vec<(&'static str, RecordBatch)>§sidecars: Vec<(&'static str, Vec<u8>)>

Opaque files published alongside the tables, by name.

Indexes over what a block contains, for the questions the block name cannot answer — see crate::bloom. The read path treats a missing sidecar as “no information”, so an old block or a signal that publishes none costs nothing but a scan.

§min_ts: i64

Oldest and newest row. These become the block’s directory name, which is how the read path prunes without opening a file.

§max_ts: i64§num_rows: usize

Rows in the root table. Reported, not derived from tables, because “how many spans” is not “how many rows in the biggest table”.

Implementations§

Source§

impl Sealed

Source

pub fn new( num_rows: usize, tables: Vec<(&'static str, RecordBatch)>, min_ts: i64, max_ts: i64, ) -> Sealed

Assemble a sealed block, deriving the sidecars that every signal gets.

The attribute filter and the zone map are built here rather than in each signal’s seal for one reason: a signal that forgets to build one is merely slow, but a signal that grows a new attribute table and forgets to include it publishes an index that omits real values, and the read path then skips blocks that hold matching rows. Deriving them from the tables, once, makes that class of mistake unavailable — and the zone map needs it even more than the filter does, since a key missing from it is read as “this block has no such value” rather than as a false negative in a probabilistic structure.

Also where the empty-block timestamp sentinels are normalized, which was three copies of the same pair of ifs, and where the range is clamped non-negative. That clamp is the second half of logs::nanos — not a link, because it is pub(crate) and rustdoc will not resolve one: the encoders keep an out-of-range OTLP timestamp from ever becoming a negative one, and this is the single funnel all three of them seal through, so it is the cheapest place to guarantee that crate::block::publish and block::scan cannot disagree. They would: dir_name formats a negative with a leading - and parse_dir_name splits on -, so a block with a negative min_ts is published, acked as durable, and then invisible to every query and to retention forever.

Source

pub fn with( sidecars: Sidecars, num_rows: usize, tables: Vec<(&'static str, RecordBatch)>, min_ts: i64, max_ts: i64, ) -> Sealed

As Sealed::new, but Sidecars::Skip leaves them out.

Only SignalBuilder::snapshot skips them, and only because they are the expensive half of a seal — attrs::index and zone::index walk every attribute row, which the encode bench measures at roughly three times the cost of appending that row in the first place. A snapshot has no directory to publish them into and is always scanned, so building them would be pure waste repeated on every idle tick.

Source

pub fn with_sidecar(self, name: &'static str, bytes: Option<Vec<u8>>) -> Sealed

Attach a signal-specific sidecar. None writes nothing, which the reader reads as “no information about this block” — which is also how Sidecars::Skip gets away with omitting all of them.

Source

pub fn table(&self, name: &str) -> Option<&RecordBatch>

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
§

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

§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

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

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more