pub struct DatabaseHandle { /* private fields */ }Expand description
A lightweight caller-specific handle onto one shared [DatabaseCore]
(spec §10.1, S1A-001).
Obtained from crate::manager::DatabaseManager::open_shared. Cloning or
dropping a handle has no storage side effects; storage closes when the
last core reference drops or Self::shutdown runs.
Implementations§
Source§impl DatabaseHandle
impl DatabaseHandle
Sourcepub fn identity(&self) -> &HandleIdentity
pub fn identity(&self) -> &HandleIdentity
The identity bound to this handle.
Sourcepub fn access(&self) -> HandleAccess
pub fn access(&self) -> HandleAccess
The access restriction bound to this handle.
Whether two handles reference the exact same process-local core.
Sourcepub fn lifecycle_state(&self) -> LifecycleState
pub fn lifecycle_state(&self) -> LifecycleState
The current lifecycle state of the shared core (S1A-004).
Sourcepub fn operation_guard(&self) -> Result<OperationGuard>
pub fn operation_guard(&self) -> Result<OperationGuard>
Admit one operation against the shared core (S1A-004). The RAII guard
releases the operation slot on drop; new operations are rejected once
the core leaves LifecycleState::Open.
Sourcepub fn query(
&self,
table: &str,
query: &Query,
projection: Option<&[u16]>,
) -> Result<Vec<Row>>
pub fn query( &self, table: &str, query: &Query, projection: Option<&[u16]>, ) -> Result<Vec<Row>>
Execute an authorized native query with live roles, RLS, masks, and column grants.
Sourcepub fn count(&self, table: &str) -> Result<u64>
pub fn count(&self, table: &str) -> Result<u64>
Count rows visible to this handle after live authorization and RLS.
Sourcepub fn rows(&self, table: &str) -> Result<Vec<Row>>
pub fn rows(&self, table: &str) -> Result<Vec<Row>>
Return all rows visible to this handle after RLS and masks.
Sourcepub fn create_table(&self, name: &str, schema: Schema) -> Result<u64>
pub fn create_table(&self, name: &str, schema: Schema) -> Result<u64>
Create a table through this handle’s live principal.
Sourcepub fn put(&self, table: &str, cells: Vec<(u16, Value)>) -> Result<Option<i64>>
pub fn put(&self, table: &str, cells: Vec<(u16, Value)>) -> Result<Option<i64>>
Atomically insert one row through this handle’s live principal.
Sourcepub fn delete(&self, table: &str, row_id: RowId) -> Result<()>
pub fn delete(&self, table: &str, row_id: RowId) -> Result<()>
Atomically delete one row through this handle’s live principal.
Sourcepub fn create_user(&self, username: &str, password: &str) -> Result<UserEntry>
pub fn create_user(&self, username: &str, password: &str) -> Result<UserEntry>
Create a catalog user. Admin only.
Sourcepub fn create_role(&self, role: &str) -> Result<RoleEntry>
pub fn create_role(&self, role: &str) -> Result<RoleEntry>
Create a role. Admin only.
Sourcepub fn grant_role(&self, username: &str, role: &str) -> Result<()>
pub fn grant_role(&self, username: &str, role: &str) -> Result<()>
Grant a role to a catalog user. Admin only.
Sourcepub fn revoke_role(&self, username: &str, role: &str) -> Result<()>
pub fn revoke_role(&self, username: &str, role: &str) -> Result<()>
Revoke a role from a catalog user. Admin only.
Sourcepub fn grant_permission(&self, role: &str, permission: Permission) -> Result<()>
pub fn grant_permission(&self, role: &str, permission: Permission) -> Result<()>
Grant one permission to a role. Admin only.
Sourcepub fn revoke_permission(
&self,
role: &str,
permission: Permission,
) -> Result<()>
pub fn revoke_permission( &self, role: &str, permission: Permission, ) -> Result<()>
Revoke one permission from a role. Admin only.
Sourcepub fn shutdown(&self, drain_deadline: Duration) -> Result<()>
pub fn shutdown(&self, drain_deadline: Duration) -> Result<()>
Shut the shared core down (spec §10.1, S1A-004): drain in-flight
operations within drain_deadline, sync durable state, release the
file lock, and mark the core Closed. Every handle — including this
one — then rejects further operations. Dropping a handle never closes
storage; only this method or the last core drop does.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DatabaseHandle
impl !RefUnwindSafe for DatabaseHandle
impl !UnwindSafe for DatabaseHandle
impl Send for DatabaseHandle
impl Sync for DatabaseHandle
impl Unpin for DatabaseHandle
impl UnsafeUnpin for DatabaseHandle
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