Skip to main content

RemoteEnv

Struct RemoteEnv 

pub struct RemoteEnv { /* private fields */ }

Trait Implementations§

§

impl Env for RemoteEnv

§

fn supports_inline(&self) -> bool

Waits on the calling shard thread for the server’s reply: spins for about the recent round trip, then parks until the reader thread hands the reply over. The runtime takes this path only when it is idle and the last round trip was fast.

§

fn recover_log(&mut self, after: Lsn) -> Result<(Vec<(Lsn, RecordBuf)>, Lsn)>

The server reads its log and sends this shard’s sections after after, in pages; the records are decoded here.

§

fn monotonic_us(&self) -> u64

A clock for elapsed-time measurements. Virtual environments use their own clock.
§

fn now_ms(&self) -> u64

Unix time in milliseconds.
§

fn random(&mut self) -> u64

A random 64-bit value (deterministic under simulation).
§

fn set_notify(&mut self, notify: Notify)

Installs the callback used to wake the shard when a background flush or checkpoint completes.
§

fn submit(&mut self, batch: Batch)

Writes batch and makes it durable in the background. The runtime keeps at most max_in_flight batches in flight, each following the last, and reports the next batch only while fewer are outstanding.
§

fn flush_inline(&mut self, batch: Batch) -> Result<Lsn>

Writes batch and makes it durable on the calling thread.
§

fn last_flush_us(&self) -> u64

Duration of the most recent flush in microseconds (0 if unknown). The runtime flushes inline only on fast disks.
§

fn poll_flushed(&mut self) -> Option<Result<Lsn>>

The outcome of the in-flight background flush, once it completed: the position now durable. With several batches in flight, any advance of it (see max_in_flight).
§

fn store_append(&mut self, frame_bytes: &[u8]) -> Result<u64>

Appends one run store frame (not yet durable). Returns its offset.
§

fn store_append_history( &mut self, frame: &[u8], run: RunId, lsn: Lsn, ) -> Result<u64>

Append a full terminal journal selected for immutable archival.
§

fn store_read(&mut self, offset: u64, len: u32) -> Result<Vec<u8>>

Reads len bytes of the run store at offset.
§

fn store_len(&self) -> u64

§

fn store_generation(&self) -> u64

§

fn compact_store(&mut self, live: &[(RunId, BlobRef)]) -> Result<bool>

Copy these live frames in order into a fresh generation. A successful replacement starts with the store header. The preceding generation remains recoverable until its last checkpoint is safely superseded.
§

fn visibility_candidates( &mut self, filter: &ListFilter, limit: usize, ) -> Option<Candidates>

Secondary-index candidates for a checkpointed store prefix. Callers reconcile newer frames and validate matches against current state.
§

fn checkpoint( &mut self, checkpoint: Checkpoint, delete_through_segment: Option<u64>, )

Makes the run store durable through its current length, writes the checkpoint atomically, then deletes log segments numbered at or below delete_through_segment. May run in the background; completion is reported by poll_checkpoint.
§

fn poll_checkpoint(&mut self) -> Option<Result<Lsn>>

Some once the last checkpoint finished.
§

fn load_checkpoint(&mut self) -> Result<Option<Checkpoint>>

The newest valid checkpoint, if any.
§

fn load_store(&mut self, generation: u64, len: u64) -> Result<Vec<u8>>

Reads the run store prefix named by a checkpoint (header included). With no checkpoint, the whole store is ignored and a fresh one begun.
§

fn recover_store( &mut self, generation: u64, len: u64, visit: &mut dyn FnMut(u64, u32, StoreEntry), ) -> Result<()>

Visit the checkpoint’s committed store prefix. File and remote implementations can stream it without materializing every journal. Read more
§

fn segments(&mut self) -> Result<Vec<u64>>

Log segment numbers present, ascending.
§

fn read_segment(&mut self, segment: u64) -> Result<Vec<u8>>

§

fn sync_recovered(&mut self) -> Result<()>

Makes everything read during recovery durable (it may have been in the page cache only when the process died).
§

fn discard_segment(&mut self, segment: u64) -> Result<()>

Removes a segment that recovery found was never activated (its first flush tore its header), so later recoveries never mistake it for a damaged segment in the middle of the log.
§

fn exclusive_log(&self) -> bool

Whether this shard’s engine is the only writer of its segment files, so recovery may delete trailing segments that hold no valid record and reuse their numbers. Replicated storage, where an applier also writes segments, must say no.
§

fn first_segment_bytes(&self, maximum: u64) -> u64

Capacity of the first segment after opening a shard. Full-size successors can be prepared in the background as the shard fills.
§

fn open_log(&mut self, segment: u64) -> Result<()>

Starts writing at segment segment; earlier segments are read-only.
§

fn shared_log(&self) -> bool

Log format 3: records go to a log shared with other shards, recovery gets them from recover_log, and the segment methods are unused.
§

fn standby(&self) -> bool

Server mode with per-shard leases: another worker holds this shard now. The engine then opens without waiting for it; the shard thread waits in wait_lease before it recovers the shard, and calls to the shard queue meanwhile.
§

fn wait_lease(&mut self, timeout: Duration) -> Result<bool>

Waits up to timeout for this shard’s lease: Ok(true) once this worker holds it, Ok(false) if not yet, an error if it never will (the connection is gone).
§

fn log_position(&self) -> u64

Log format 3 position for a checkpoint taken now: the sequence of the first shared-log batch that can hold this shard’s later records. 0 for per-shard (format 2) logs.
§

fn log_segment(&self) -> u64

Log format 3: the shared log’s active segment (checkpoints follow segment rolls). 0 for per-shard logs.
§

fn checkpoint_wanted(&self) -> bool

Log format 3: this shard alone holds back retiring a segment of the shared log; one more checkpoint (even with nothing new) frees it.
§

fn due_wanted(&self) -> bool

Server mode’s invoked workers: the host asks what the shard has left to do. When this returns true at the end of a tick, the runtime answers with report_due; it also does once when it closes. Checked once per tick, so it must be cheap.
§

fn report_due(&mut self, due: Due, closed: bool)

What the shard has left to do (see due_wanted); closed for the report a clean close makes last.
§

fn relay(&self) -> Option<Arc<dyn Relay>>

Server mode: carries messages between this shard and shards another process holds. None (the default): every shard is in this process.
Source§

fn durable_on_append(&self) -> bool

Records are durable as soon as they are appended (memory mode): the runtime then builds no batch and calls no flush for them.
Source§

fn max_in_flight(&self) -> usize

How many submitted batches may be outstanding at once. With more than one, poll_flushed reports each advance of the durable position, which may cover only the earlier batches.
Source§

fn recovers(&self) -> bool

Whether a later open recovers what this environment stores (false for memory mode). Without that, the runtime writes nothing only recovery reads, such as the persisted run index.
Source§

fn read_segment_from( &mut self, segment: u64, offset: u64, len: usize, ) -> Result<(Vec<u8>, bool), Error>

Reads about len bytes of segment segment starting at offset, fewer at the end of the file; the flag says the bytes reach the end. Recovery reads a segment’s valid prefix this way instead of the whole preallocated file. The default reads everything at once.
Source§

fn read_segment_header(&mut self, segment: u64) -> Result<Vec<u8>, Error>

The segment’s header block (or the whole file, if shorter). Recovery reads only headers of segments that lie wholly behind the checkpoint, and does not count them as recovered.
Source§

fn checkpoint_on_roll(&self) -> bool

After the log rolled to a new segment: whether this (active) shard should checkpoint for it. Per-shard logs: always. The shared log: only a shard whose oldest retained record is in the segment it retires next.
Source§

fn checkpoint_wanted_on_close(&self) -> bool

At a clean close: this shard holds any segment of the shared log older than the active one. Every such shard checkpoints, not only the one holding the oldest (shards close at once, so the next holder may already be gone when the oldest one lets go).
Source§

fn log_stats(&self) -> LogStats

The shared log’s own counters, reported by one shard of the log so that a sum over shards counts them once: device writes, bytes those writes put on the device (headers and padding included), and segment rolls. Zeros elsewhere.
Source§

fn preparing_segment(&self) -> bool

Whether a segment file is being prepared in the background (stall tracing reports it).

Auto Trait Implementations§

Blanket Implementations§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.