DirectSwapFile

Struct DirectSwapFile 

Source
pub struct DirectSwapFile { /* private fields */ }
Expand description

The generic paging core, lifted to atlas-tier (CUDA- and verbs-free). Re-exported under the atlas_tier names (no historical aliases). O_DIRECT fixed-stride swap file on NVMe (the peer’s cold tier). record_bytes MUST be a 4 KiB multiple (O_DIRECT) — the SSM snapshot blob (66,846,720 B = 16,320 × 4 KiB) already is. Records are addressed by disk_slot at disk_slot * record_bytes; the file grows sparsely as slots are allocated.

Buffers passed to read/write must be page-aligned for O_DIRECT; read_record / write_record stage through an internal aligned bounce (a full extra record memcpy) when they aren’t. Both in-tree callers are aligned: the peer passes its mmap’d arena, and crate::Residency’s scratch is a PageAlignedBuf — it used to be a plain Vec, which took the bounce every single time.

A 0-byte swap file is not evidence of a broken write. Records are only written when the residency’s hot arena has no free slot, so the first num_slots PUTs of distinct keys never touch this file; with the default 64-slot SSM arena the first pwrite happens on spill #65. The size then jumps to (highest disk_slot + 1) × record_bytes — and never shrinks, since discard_record is the documented no-op (freed records are reused by index, their blocks are never punched back out).

Implementations§

Trait Implementations§

Source§

impl SwapStore for DirectSwapFile

Source§

fn record_bytes(&self) -> usize

Source§

fn write_record(&mut self, disk_slot: usize, bytes: &[u8]) -> Result<(), Error>

Source§

fn read_record(&self, disk_slot: usize, out: &mut [u8]) -> Result<(), Error>

Source§

fn discard_record(&mut self, _disk_slot: usize)

Optional: reclaim disk space for a freed slot (default no-op; a hole in a preallocated file is fine — the free-list reuses the index).

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.

§

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.

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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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