Skip to main content

SignalBuilder

Trait SignalBuilder 

Source
pub trait SignalBuilder:
    Default
    + Send
    + 'static {
    type Request: Send + 'static;

    const SIGNAL: &'static str;

    // Required methods
    fn has_headroom_for(&self, req: &Self::Request) -> bool;
    fn append_request(&mut self, req: &Self::Request) -> Result<usize>;
    fn approx_bytes(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn finish(&mut self) -> Result<Sealed>;
    fn snapshot(&self) -> Result<Sealed>;
}
Expand description

One signal’s accumulator, from the flusher’s point of view.

Required Associated Constants§

Source

const SIGNAL: &'static str

Directory component under the data dir. Also the block name prefix, so changing it is an on-disk format change.

Required Associated Types§

Source

type Request: Send + 'static

The decoded OTLP export request this signal accepts.

Required Methods§

Source

fn has_headroom_for(&self, req: &Self::Request) -> bool

Whether req is guaranteed to fit without overflowing a UInt16 dictionary or id space.

Must be conservative: an Arrow builder cannot be rolled back, so the flusher relies on a true here meaning Self::append_request will not fail on capacity. Answering false unnecessarily costs a slightly small block; answering true wrongly wedges the node.

Source

fn append_request(&mut self, req: &Self::Request) -> Result<usize>

Absorb one export request, returning the number of root-table rows added.

Source

fn approx_bytes(&self) -> usize

Rough resident cost, with variable-width heaps measured rather than estimated from row counts — a 32 KB GenAI prompt must not weigh the same as a 20-byte one.

Source

fn is_empty(&self) -> bool

Source

fn finish(&mut self) -> Result<Sealed>

Seal and reset. After this returns, self is a fresh builder — including on the error path, where the caller has no way to know how far through the column-by-column finish it got.

Source

fn snapshot(&self) -> Result<Sealed>

Materialise the rows accumulated so far without resetting, for Open. Sidecar-free; see Sealed::with.

Costs one buffer copy per column, so the flusher only calls it when its channel has drained — under sustained ingest the channel never empties, the snapshot never runs, and the read-your-writes window closes on its own because a busy block seals in well under max_block_age.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§