Skip to main content

TabletLayout

Struct TabletLayout 

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

On-node directory layout of one tablet replica and its Raft group (spec section 12.3):

node-data/
  tablets/<tablet-id>/{state,runs,indexes,temp}   + tablet.json
  groups/<raft-group-id>/{raft,snapshots}

The applied MVCC state, sorted runs, local index generations, and compaction state live under the tablet directory; the Raft log and snapshots live under the group directory, so a group can outlive any single applied-state rebuild (spec section 4.4: runs and indexes are applied state and may be rebuilt).

Implementations§

Source§

impl TabletLayout

Source

pub fn new( node_data: impl Into<PathBuf>, tablet_id: TabletId, raft_group_id: RaftGroupId, ) -> Self

The layout of tablet_id/raft_group_id under node_data.

Source

pub fn tablet_id(&self) -> TabletId

The tablet this layout belongs to.

Source

pub fn raft_group_id(&self) -> RaftGroupId

The Raft group this layout belongs to.

Source

pub fn node_data(&self) -> &Path

The node data root the layout lives under.

Source

pub fn tablet_dir(&self) -> PathBuf

node-data/tablets/<tablet-id>.

Source

pub fn state_dir(&self) -> PathBuf

tablets/<tablet-id>/state (applied MVCC + compaction state).

Source

pub fn runs_dir(&self) -> PathBuf

tablets/<tablet-id>/runs (sorted runs).

Source

pub fn indexes_dir(&self) -> PathBuf

tablets/<tablet-id>/indexes (local index generations).

Source

pub fn temp_dir(&self) -> PathBuf

tablets/<tablet-id>/temp (spill scratch space).

Source

pub fn group_dir(&self) -> PathBuf

node-data/groups/<raft-group-id>.

Source

pub fn raft_dir(&self) -> PathBuf

groups/<raft-group-id>/raft (Raft log).

Source

pub fn snapshots_dir(&self) -> PathBuf

Legacy layout path groups/<raft-group-id>/snapshots (unused by the consensus SM). Prefer Self::raft_snapshot_dir (review N3).

Source

pub fn raft_snapshot_dir(&self) -> PathBuf

groups/<raft-group-id>/raft/snapshot — the path the consensus state machine actually writes (review N3 reconciliation).

Source

pub fn metadata_path(&self) -> PathBuf

tablets/<tablet-id>/tablet.json.

Source

pub fn create(&self, descriptor: &TabletDescriptor) -> Result<(), TabletError>

Creates the directory tree and persists the initial tablet metadata.

The metadata file is created atomically and only if absent (the same hard-link publish idiom as the node identity); a concurrent or repeated create that finds identical metadata succeeds, while different existing metadata fails closed with TabletError::MetadataConflict — a tablet directory is never silently repurposed.

Source

pub fn store_metadata( &self, descriptor: &TabletDescriptor, ) -> Result<(), TabletError>

Atomically replaces the persisted metadata (used by the meta-driven apply path when the descriptor’s generation advances). The descriptor is validated and must name this layout’s tablet and group.

Source

pub fn load_metadata(&self) -> Result<TabletDescriptor, TabletError>

Loads and verifies the persisted tablet metadata. Missing, corrupt, unknown-version, wrong-checksum, or wrong-tablet files all fail closed (spec sections 4.10, 12.3).

Source

pub fn validate(&self) -> Result<TabletDescriptor, TabletError>

Opens the layout for use: verifies the persisted metadata and the presence of every required directory, failing closed on any missing or corrupt piece (spec section 12.3).

Source

pub fn teardown(&self) -> Result<(), TabletError>

Removes the local replica: the tablet directory and the Raft-group directory (spec section 12.5 step 11; the consensus membership removal is the runtime’s half). Idempotent — a partially torn-down or absent directory is fine — but never destructive across identity: a tablet.json that names a different tablet or group fails closed with TabletError::TabletMismatch instead of deleting foreign state.

Trait Implementations§

Source§

impl Clone for TabletLayout

Source§

fn clone(&self) -> TabletLayout

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TabletLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TabletLayout

Source§

impl PartialEq for TabletLayout

Source§

fn eq(&self, other: &TabletLayout) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TabletLayout

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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