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
impl DatabaseCore
Sourcepub fn file_identity(&self) -> Result<DatabaseFileIdentity>
pub fn file_identity(&self) -> Result<DatabaseFileIdentity>
The stable directory-handle identity of this core’s root (S1A-003).
Sourcepub fn lifecycle_state(&self) -> LifecycleState
pub fn lifecycle_state(&self) -> LifecycleState
The current lifecycle state (S1A-004).
Sourcepub fn operation_guard(self: &Arc<Self>) -> Result<OperationGuard>
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.
Sourcepub fn shutdown(self: &Arc<Self>, drain_deadline: Duration) -> Result<()>
pub fn shutdown(self: &Arc<Self>, drain_deadline: Duration) -> Result<()>
Ordered core shutdown (spec §10.1, S1A-004):
- Transition
Open→Draining. - Reject new sessions and writes (new
Self::operation_guards fail from this point). - 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.
- Wait for in-flight operations, up to
drain_deadline. On timeout the core staysDrainingand a later call may resume the shutdown. - Sync required durable state (group-sync the shared WAL).
- Stop workers — the Stage 1A core runs no background worker set.
- Release the file lock (and the process open-registry entries).
- 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§
Auto Trait Implementations§
impl !Freeze for DatabaseCore
impl !RefUnwindSafe for DatabaseCore
impl !UnwindSafe for DatabaseCore
impl Send for DatabaseCore
impl Sync for DatabaseCore
impl Unpin for DatabaseCore
impl UnsafeUnpin for DatabaseCore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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