Struct mz_persist::indexed::Indexed
source · [−]Expand description
A persistent, compacting, indexed data structure of (Key, Value, Time, i64)
updates.
Indexed contains a set of named persistent Arrangements.
Notes:
- Requests are split into two types: unbatched and batched. An unbatched
command is run entirely by itself (the applied state has just been written
to durable storage, then the command is run, then the resulting state is
immediately written to durable storage). A batched command is applied to
the machine state, but instead of immediately serializing the state to
storage, we buffer the command response in Pending. Any other batched
command can also be run and similarly buffered in Pending. Then, the next
time we get an unbatched command (or
step
is called), all pending batched commands are made durable at once (and responses filled, listeners updated, etc). This is a performance optimization to amortize the cost of writing to durable storage across many of those requests. The most common requests (write, seal, allow_compaction) are all batched to exploit this. All unbatched commands are expected to be relatively infrequent (to avoid excessive barriers in our pipelining). - When evaluating a request, the work of updating the state is given to AppliedState (which has no knowledge of storage, etc). Then, if this was successful, Indexed will serialize AppliedState and durably write it down.
Implementations
sourceimpl<L: Log, B: Blob> Indexed<L, B>
impl<L: Log, B: Blob> Indexed<L, B>
sourceimpl<L: Log, B: BlobRead> Indexed<L, B>
impl<L: Log, B: BlobRead> Indexed<L, B>
sourcepub fn apply_read(&mut self, cmd: CmdRead) -> bool
pub fn apply_read(&mut self, cmd: CmdRead) -> bool
Applies the given read-only input to the state machine.
Returns false to indicate a graceful shutdown, true otherwise.
sourceimpl<L: Log, B: BlobRead> Indexed<L, B>
impl<L: Log, B: BlobRead> Indexed<L, B>
sourcepub fn has_pending_responses(&self) -> bool
pub fn has_pending_responses(&self) -> bool
Return true if Pending has at least one pending response.
sourceimpl<L: Log, B: Blob> Indexed<L, B>
impl<L: Log, B: Blob> Indexed<L, B>
sourcepub fn step_or_log(&mut self) -> Vec<MaintenanceReq>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn step_or_log(&mut self) -> Vec<MaintenanceReq>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Drains writes from the log into the unsealed and does any necessary resulting compaction work.
In production, step_or_log should just be called in a loop (probably with some smarts about waiting to call it only after there have been some writes), but it’s exposed this way so we can write deterministic tests.
Trait Implementations
Auto Trait Implementations
impl<L, B> !RefUnwindSafe for Indexed<L, B>
impl<L, B> Send for Indexed<L, B> where
L: Send,
impl<L, B> Sync for Indexed<L, B> where
L: Sync,
impl<L, B> Unpin for Indexed<L, B> where
L: Unpin,
impl<L, B> !UnwindSafe for Indexed<L, B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more