pub struct Spine<B: Batch> {Show 13 fields
operator: OperatorInfo,
logger: Option<Logger>,
logical_frontier: Antichain<B::Time>,
physical_frontier: Antichain<B::Time>,
merging: Vec<MergeState<B>>,
pending: Vec<B>,
upper: Antichain<B::Time>,
effort: usize,
activator: Option<Activator>,
exert_logic_param: Vec<(usize, usize, usize)>,
exert_logic: Option<ExertionLogic>,
consolidation_credit: usize,
progress_grants: usize,
}Expand description
An append-only collection of update tuples.
A spine maintains a small number of immutable collections of update tuples, merging the collections when two have similar sizes. In this way, it allows the addition of more tuples, which may then be merged with other immutable collections.
Fields§
§operator: OperatorInfo§logger: Option<Logger>§logical_frontier: Antichain<B::Time>§physical_frontier: Antichain<B::Time>§merging: Vec<MergeState<B>>§pending: Vec<B>§upper: Antichain<B::Time>§effort: usize§activator: Option<Activator>§exert_logic_param: Vec<(usize, usize, usize)>Parameters to exert_logic, containing tuples of (index, count, length).
exert_logic: Option<ExertionLogic>Logic to indicate whether and how many records we should introduce in the absence of actual updates.
consolidation_credit: usizeFuel funded by inserted updates and not yet spent. It does not decay: it accumulates in proportion to total input, and later turns spend it down, so the total stays proportional to input.
progress_grants: usizePolicy allowances funded by inserted batches and not yet spent.
Implementations§
Source§impl<B: Batch> Spine<B>
impl<B: Batch> Spine<B>
Sourcefn drop_batches(&mut self)
fn drop_batches(&mut self)
Drops and logs batches. Used in set_logical_compaction and drop.
Source§impl<B: Batch> Spine<B>
impl<B: Batch> Spine<B>
Sourcefn exert_effort(&mut self) -> Option<usize>
fn exert_effort(&mut self) -> Option<usize>
Determine the amount of effort we should exert in the absence of updates.
This method prepares an iterator over batches, including the level, count, and length of each layer.
It supplies this to self.exert_logic, who produces the response of the amount of exertion to apply.
Sourcepub fn with_effort(
effort: usize,
operator: OperatorInfo,
logger: Option<Logger>,
activator: Option<Activator>,
) -> Self
pub fn with_effort( effort: usize, operator: OperatorInfo, logger: Option<Logger>, activator: Option<Activator>, ) -> Self
Allocates a fueled Spine with a specified effort multiplier.
This trace will merge batches progressively, with each inserted batch applying a multiple
of the batch’s length in effort to each merge. The effort parameter is that multiplier.
This value should be at least one for the merging to happen; a value of zero is not helpful.
Sourcefn spend_funding(&mut self, effort: usize) -> bool
fn spend_funding(&mut self, effort: usize) -> bool
Spend funding for one policy request, returning whether any was available.
Sourcefn grant(&mut self, effort: usize)
fn grant(&mut self, effort: usize)
Apply one policy allowance: fuel for active merges, or a virtual introduction.
Sourcefn consider_merges(&mut self)
fn consider_merges(&mut self)
Migrate data from self.pending into self.merging.
This method reflects on the bookmarks held by others that may prevent merging, and in the case that new batches can be introduced to the pile of mergeable batches, it gets on that.
Sourcepub fn introduce_batch(&mut self, batch: Option<B>, batch_index: usize)
pub fn introduce_batch(&mut self, batch: Option<B>, batch_index: usize)
Introduces a batch at an indicated level.
The level indication is often related to the size of the batch, but it can also be used to artificially fuel the computation by supplying empty batches at non-trivial indices, to move merges along.
Sourcefn roll_up(&mut self, index: usize)
fn roll_up(&mut self, index: usize)
Ensures that an insertion at layer index will succeed.
This method is subject to the constraint that all existing batches should occur at higher levels, which requires it to “roll up” batches present at lower levels before the method is called. In doing this, we should not introduce more virtual records than 2^index, as that is the amount of excess fuel we have budgeted for completing merges.
Sourcepub fn apply_fuel(&mut self, fuel: &mut isize)
pub fn apply_fuel(&mut self, fuel: &mut isize)
Applies an amount of fuel to merges in progress.
The supplied fuel is for each in progress merge, and if we want to spend
the fuel non-uniformly (e.g. prioritizing merges at low layers) we could do
so in order to maintain fewer batches on average (at the risk of completing
merges of large batches later, but tbh probably not much later).
Sourcefn insert_at(&mut self, batch: Option<B>, index: usize)
fn insert_at(&mut self, batch: Option<B>, index: usize)
Inserts a batch at a specific location.
This is a non-public internal method that can panic if we try and insert into a layer which already contains two batches (and is still in the process of merging).
Sourcefn complete_at(&mut self, index: usize) -> Option<B>
fn complete_at(&mut self, index: usize) -> Option<B>
Completes and extracts what ever is at layer index.
Sourcefn tidy_layers(&mut self)
fn tidy_layers(&mut self)
Attempts to draw down large layers to size appropriate layers.
Trait Implementations§
Source§impl<B: Batch + Clone + 'static> Trace for Spine<B>
impl<B: Batch + Clone + 'static> Trace for Spine<B>
Source§fn exert(&mut self)
fn exert(&mut self)
Apply some amount of effort to trace maintenance.
Whether and how much effort to apply is determined by self.exert_logic, a closure the user can set.
Source§fn new(
info: OperatorInfo,
logging: Option<Logger>,
activator: Option<Activator>,
) -> Self
fn new( info: OperatorInfo, logging: Option<Logger>, activator: Option<Activator>, ) -> Self
Source§fn set_exert_logic(&mut self, logic: ExertionLogic)
fn set_exert_logic(&mut self, logic: ExertionLogic)
Source§impl<B: Batch + Clone + 'static> TraceReader for Spine<B>
impl<B: Batch + Clone + 'static> TraceReader for Spine<B>
Source§fn batches_through(
&mut self,
upper: AntichainRef<'_, Self::Time>,
) -> Option<Vec<Self::Batch>>
fn batches_through( &mut self, upper: AntichainRef<'_, Self::Time>, ) -> Option<Vec<Self::Batch>>
upper. Read moreSource§fn set_logical_compaction(&mut self, frontier: AntichainRef<'_, B::Time>)
fn set_logical_compaction(&mut self, frontier: AntichainRef<'_, B::Time>)
Source§fn get_logical_compaction(&mut self) -> AntichainRef<'_, B::Time>
fn get_logical_compaction(&mut self) -> AntichainRef<'_, B::Time>
Source§fn set_physical_compaction(&mut self, frontier: AntichainRef<'_, B::Time>)
fn set_physical_compaction(&mut self, frontier: AntichainRef<'_, B::Time>)
Source§fn get_physical_compaction(&mut self) -> AntichainRef<'_, B::Time>
fn get_physical_compaction(&mut self) -> AntichainRef<'_, B::Time>
Source§fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F)
fn map_batches<F: FnMut(&Self::Batch)>(&self, f: F)
Source§fn cursor(
&mut self,
) -> (CursorList<<Self::Batch as Navigable>::Cursor>, Vec<Self::Batch>)
fn cursor( &mut self, ) -> (CursorList<<Self::Batch as Navigable>::Cursor>, Vec<Self::Batch>)
Source§fn cursor_through(
&mut self,
upper: AntichainRef<'_, Self::Time>,
) -> Option<(CursorList<<Self::Batch as Navigable>::Cursor>, Vec<Self::Batch>)>
fn cursor_through( &mut self, upper: AntichainRef<'_, Self::Time>, ) -> Option<(CursorList<<Self::Batch as Navigable>::Cursor>, Vec<Self::Batch>)>
upper. Read moreSource§fn read_upper(&mut self, target: &mut Antichain<Self::Time>)
fn read_upper(&mut self, target: &mut Antichain<Self::Time>)
Auto Trait Implementations§
impl<B> !RefUnwindSafe for Spine<B>
impl<B> !Send for Spine<B>
impl<B> !Sync for Spine<B>
impl<B> !UnwindSafe for Spine<B>
impl<B> Freeze for Spine<B>
impl<B> Unpin for Spine<B>
impl<B> UnsafeUnpin for Spine<B>where
Antichain<<B as BatchReader>::Time>: UnsafeUnpin,
Vec<MergeState<B>>: UnsafeUnpin,
Vec<B>: UnsafeUnpin,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.