pub(crate) struct Block {
signal: Signal,
pub(crate) root: RecordBatch,
attrs: Option<Attrs>,
resource_attrs: Option<Attrs>,
scope_attrs: Option<Attrs>,
children: Vec<Child>,
detail: bool,
}Expand description
The tables of one block, opened and ready to scan.
No Mmap handle is kept: every Arrow buffer read out of a block owns an
Arc<Mmap> of its own (see block::open_table), so holding the
RecordBatch is what holds the mapping. That is also why row data can be
borrowed straight out of these batches with ordinary lifetimes.
Fields§
§signal: Signal§root: RecordBatch§attrs: Option<Attrs>Record-level attributes; parent_id indexes root directly.
resource_attrs: Option<Attrs>§scope_attrs: Option<Attrs>§children: Vec<Child>Rows that hang off a root row rather than being one: a span’s events and its links. Empty for logs.
detail: boolWhether the five fields above have been read yet.
They are not read at open. block::open_table CRC32s every byte it
maps — that is the guarantee, not overhead — and on this corpus the
attribute tables are 42.9% of a logs block and 45.7% of a traces block
(log_attrs 768,352 KiB of 1,794,752; span_attrs 780,372 of
1,710,020). A query with no attribute predicate that lands on a block
contributing no rows was hashing all of that to read a timestamp
column. See Block::detail for who asks for them and when.
Implementations§
Source§impl Block
impl Block
fn open(bref: &Src<'_>, signal: Signal) -> Result<Option<Block>>
Sourcefn detail(&mut self, bref: &Src<'_>) -> Result<()>
fn detail(&mut self, bref: &Src<'_>) -> Result<()>
Map everything that is not the root table: the three attribute levels and, for traces, the child tables and their own attributes.
Separate from open because these are the expensive
tables and most blocks in a scan need none of them. Two callers ask,
both in scan_one: a query carrying an attribute predicate, before
select, because the predicate is evaluated against them; and any
block that produced a hit, because rendering a row emits its
attributes. A block that matches nothing and is asked nothing about
attributes never maps them and never hashes them.
Idempotent, so the two callers can both fire without checking.
This does not weaken the checksum: what changes is which tables a query reads, and every table it reads is still verified in full before a byte of it is returned. A corrupt attribute table that no query touches is caught by the first query that touches it.
Sourcefn time(&self) -> Option<&[i64]>
fn time(&self) -> Option<&[i64]>
The root’s time column as a raw slice, straight out of the mapping.
Sourcefn select(&self, q: &Search, bref: &Src<'_>) -> Vec<u32>
fn select(&self, q: &Search, bref: &Src<'_>) -> Vec<u32>
Row numbers of root matching the query, ascending.
Sourcefn attr_rows(&self, key: &str, op: Op, value: &Value, n: usize) -> Vec<bool>
fn attr_rows(&self, key: &str, op: Op, value: &Value, n: usize) -> Vec<bool>
A bitmap over root rows: does this record carry key op value at any
attribute level it has — record, resource, scope, or one of its own
child rows?
Sourcefn emit_row(&self, j: &mut Json, row: u32)
fn emit_row(&self, j: &mut Json, row: u32)
Write one root row as a JSON object, attributes merged in and child rows nested under it.
Sourcefn emit_children(&self, j: &mut Json, c: &Child, row: u32)
fn emit_children(&self, j: &mut Json, c: &Child, row: u32)
The events / links array of one span.
Reads the index built when the block was opened. It used to be a linear
pass over the child table per emitted row, on the argument that limit
bounds the row count — but the other factor is the block’s event count,
so the product is limit × events-in-block, and a block holds hundreds
of thousands of events. One pass at open time replaces all of them.
fn fk(&self, row: u32, name: &str) -> Option<u32>
Auto Trait Implementations§
impl !RefUnwindSafe for Block
impl !UnwindSafe for Block
impl Freeze for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnsafeUnpin for Block
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].