Skip to main content

ResourceScope

Struct ResourceScope 

Source
pub struct ResourceScope {
    resources: HashMap<Vec<u8>, u16>,
    scopes: HashMap<Vec<u8>, u16>,
    res_id: UInt16Builder,
    res_key: UInt64Builder,
    res_dropped: UInt32Builder,
    pub resource_attrs: AttrsBuilder,
    pub scope_attrs: AttrsBuilder,
}
Expand description

The resources + resource_attrs + scope_attrs arms of the star, shared by every signal.

Interning is keyed on the canonical protobuf encoding of the Resource / InstrumentationScope message. Storing the bytes rather than a hash means no collision risk, and there are only a handful of distinct resources per block so the memory is irrelevant.

Deliberately block-local. A process-wide resource dictionary would be shared mutable state on the ingest hot path, and it would break TTL-by-directory-drop — a block whose resource rows lived somewhere else could not be deleted by unlinking it.

Fields§

§resources: HashMap<Vec<u8>, u16>§scopes: HashMap<Vec<u8>, u16>§res_id: UInt16Builder§res_key: UInt64Builder§res_dropped: UInt32Builder§resource_attrs: AttrsBuilder§scope_attrs: AttrsBuilder

Implementations§

Source§

impl ResourceScope

Source

pub fn new() -> Self

Source

pub fn has_headroom( &self, resources: usize, scopes: usize, res_kv: usize, scope_kv: usize, ) -> bool

Whether this block can take resources more distinct resources, scopes more distinct scopes, and their attributes.

Source

pub fn len(&self) -> usize

Rows across all three tables, for the seal-size estimate.

Source

pub fn is_empty(&self) -> bool

Source

pub fn heap_bytes(&self) -> usize

Source

pub fn resource(&mut self, res: Option<&Resource>) -> Result<u16>

Source

pub fn scope(&mut self, scope: Option<&InstrumentationScope>) -> Result<u16>

Source

pub fn finish(&self) -> Result<[(&'static str, RecordBatch); 3]>

The three tables, in the order every signal’s block lists them: resources, resource_attrs, scope_attrs.

Trait Implementations§

Source§

impl Default for ResourceScope

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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