pub struct Indexed<L: Log, B: BlobRead> { /* private fields */ }
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

Returns a new Indexed, initializing each Unsealed and Trace with the existing data for them in the blob storage, if any.

Releases exclusive-writer locks and causes all future commands to error.

This method is idempotent.

Applies the given input to the state machine.

Returns false to indicate a graceful shutdown, true otherwise.

Applies the given read-only input to the state machine.

Returns false to indicate a graceful shutdown, true otherwise.

Return true if Pending has at least one pending response.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Wrap the input message T in a tonic::Request

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more