Skip to main content

DatabaseCore

Struct DatabaseCore 

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

The shared storage core (spec §10.1, S1A-001): one catalog, one epoch clock, shared caches, a shared WAL, and a live map of name → Arc<Table>.

DatabaseCore owns every storage resource — the durable root, the exclusive lease, the catalog, the commit log, the epoch authority, the transaction state, the mounted tables, and the page caches — plus the lifecycle state machine (S1A-004). It is shared through an Arc: the exclusive Database owner holds one reference, and every crate::handle::DatabaseHandle issued by crate::manager::DatabaseManager holds another. The core deliberately does not store one mutable “current principal” (spec §4.6): per-caller identity lives on the handle types, not inside shared storage state.

Implementations§

Source§

impl DatabaseCore

Source

pub fn root(&self) -> &Path

The canonical filesystem root this core was opened at.

Source

pub fn file_identity(&self) -> Result<DatabaseFileIdentity>

The stable directory-handle identity of this core’s root (S1A-003).

Source

pub fn lifecycle_state(&self) -> LifecycleState

The current lifecycle state (S1A-004).

Source

pub fn is_open(&self) -> bool

Whether this core currently admits new operations.

Source

pub fn operation_guard(self: &Arc<Self>) -> Result<OperationGuard>

Admit one operation against this core (S1A-004: “every operation holds an OperationGuard”). Rejected unless the core is crate::core::LifecycleState::Open.

Source

pub fn shutdown(self: &Arc<Self>, drain_deadline: Duration) -> Result<()>

Ordered core shutdown (spec §10.1, S1A-004):

  1. Transition OpenDraining.
  2. Reject new sessions and writes (new Self::operation_guards fail from this point).
  3. Cancel non-commit-critical queries — a no-op in Stage 1A: the embedded core has no central query registry yet (Stage 1D adds one), and every in-flight operation is treated as commit-critical and drained rather than cancelled.
  4. Wait for in-flight operations, up to drain_deadline. On timeout the core stays Draining and a later call may resume the shutdown.
  5. Sync required durable state (group-sync the shared WAL).
  6. Stop workers — the Stage 1A core runs no background worker set.
  7. Release the file lock (and the process open-registry entries).
  8. Mark Closed.

Repeated calls after Closed return Ok(()). Dropping one handle has no storage side effects; only this method (or the last Arc drop) closes storage.

Trait Implementations§

Source§

impl Debug for DatabaseCore

Manual Debug for DatabaseCore, mirroring Database’s (see above). The core has no cached principal by design (spec §4.6).

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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> 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.