pub struct LocalDatabase<F: VfsFile> { /* private fields */ }Expand description
One exclusively locked database handle is the transaction/session boundary. Closing drops uncommitted state. Failed I/O fences the controller until reopen.
Implementations§
Source§impl<F: VfsFile> LocalDatabase<F>
impl<F: VfsFile> LocalDatabase<F>
Sourcepub fn vault_initialized(&self) -> Result<bool, LocalReadError>
pub fn vault_initialized(&self) -> Result<bool, LocalReadError>
Metadata only; no key derivation and no credential material returned.
Sourcepub fn vault_unlock(
&mut self,
password: &str,
create: bool,
) -> Result<LocalVaultKey, LocalReadError>
pub fn vault_unlock( &mut self, password: &str, create: bool, ) -> Result<LocalVaultKey, LocalReadError>
Creation is explicit and only admitted outside a transaction. Existing files are authenticated first; wrong passwords never replace saved state.
pub fn vault_keys( &self, key: &LocalVaultKey, ) -> Result<Vec<String>, LocalReadError>
Sourcepub fn vault_reveal(
&self,
key: &LocalVaultKey,
name: &str,
) -> Result<Option<String>, LocalReadError>
pub fn vault_reveal( &self, key: &LocalVaultKey, name: &str, ) -> Result<Option<String>, LocalReadError>
Plaintext is returned only through this explicit reveal operation.
Sourcepub fn vault_put(
&mut self,
key: &LocalVaultKey,
name: &str,
value: Option<&str>,
) -> Result<(), LocalReadError>
pub fn vault_put( &mut self, key: &LocalVaultKey, name: &str, value: Option<&str>, ) -> Result<(), LocalReadError>
Mutations stage an encrypted native action alongside ordinary SQL. Errors abort an active transaction, just like failed SQL statements.
Source§impl<F: VfsFile> LocalDatabase<F>
impl<F: VfsFile> LocalDatabase<F>
pub fn create( file: F, name: impl Into<PathBuf>, now_ms: u64, ) -> Result<Self, LocalReadError>
pub fn open(file: F, name: impl Into<PathBuf>) -> Result<Self, LocalReadError>
pub fn query( &mut self, sql: &str, now_ms: u64, ) -> Result<ScalarResult, LocalReadError>
Sourcepub fn check_healthy(&self) -> Result<(), LocalReadError>
pub fn check_healthy(&self) -> Result<(), LocalReadError>
Host-side read operations honor the interrupted-publication fence.
Sourcepub fn catalog(&self) -> Result<ScalarResult, LocalReadError>
pub fn catalog(&self) -> Result<ScalarResult, LocalReadError>
Read persisted contracts without inferring schemas from row payloads.
pub fn query_stream( &self, sql: &str, parameters: &[Value], visit: &mut dyn FnMut(&[Value]) -> Result<bool, LocalReadError>, ) -> Result<StreamQueryResult, LocalReadError>
Sourcepub fn read_query(
&self,
sql: &str,
parameters: &[Value],
scopes: &[ReadScope],
) -> Result<ScalarResult, LocalReadError>
pub fn read_query( &self, sql: &str, parameters: &[Value], scopes: &[ReadScope], ) -> Result<ScalarResult, LocalReadError>
Only SELECT is admitted; callers cannot widen the host’s row scope.
pub fn query_with_params( &mut self, sql: &str, parameters: &[Value], now_ms: u64, ) -> Result<ScalarResult, LocalReadError>
pub fn into_inner(self) -> F
Auto Trait Implementations§
impl<F> !Freeze for LocalDatabase<F>
impl<F> !RefUnwindSafe for LocalDatabase<F>
impl<F> !UnwindSafe for LocalDatabase<F>
impl<F> Forget for LocalDatabase<F>
impl<F> Move for LocalDatabase<F>
impl<F> Send for LocalDatabase<F>where
F: Send,
RawVecInner: Send,
Atomic<bool>: Send,
Atomic<u64>: Send,
RwLock<RawRwLock, HashMap<String, Arc<SegmentManager>>>: Send,
RwLock<RawRwLock, HashMap<EntityId, Vec<(EntityId, RefType, String)>>>: Send,
RwLock<RawRwLock, BTreeMap<String, Vec<ContextPosting>>>: Send,
RwLock<RawRwLock, BTreeMap<(String, String), Vec<ContextPosting>>>: Send,
RwLock<RawRwLock, HashMap<u64, EntityKeys>>: Send,
RwLock<RawRwLock, HashSet<u64>>: Send,
RwLock<RawRwLock, HashSet<String>>: Send,
RwLock<RawRwLock, Shard>: Send,
RwLock<RawRwLock, HashMap<(String, String), Vec<EntityId>>>: Send,
RwLock<RawRwLock, Vec<u8>>: Send,
RawTable<(String, CollectionContract)>: Send,
ResidentStore: Send,
impl<F> Sync for LocalDatabase<F>where
F: Sync,
RawVecInner: Sync,
Atomic<bool>: Sync,
Atomic<u64>: Sync,
RwLock<RawRwLock, HashMap<String, Arc<SegmentManager>>>: Sync,
RwLock<RawRwLock, HashMap<EntityId, Vec<(EntityId, RefType, String)>>>: Sync,
RwLock<RawRwLock, BTreeMap<String, Vec<ContextPosting>>>: Sync,
RwLock<RawRwLock, BTreeMap<(String, String), Vec<ContextPosting>>>: Sync,
RwLock<RawRwLock, HashMap<u64, EntityKeys>>: Sync,
RwLock<RawRwLock, HashSet<u64>>: Sync,
RwLock<RawRwLock, HashSet<String>>: Sync,
RwLock<RawRwLock, Shard>: Sync,
RwLock<RawRwLock, HashMap<(String, String), Vec<EntityId>>>: Sync,
RwLock<RawRwLock, Vec<u8>>: Sync,
RawTable<(String, CollectionContract)>: Sync,
ResidentStore: Sync,
impl<F> Unpin for LocalDatabase<F>where
F: Unpin,
*const u8 is !null: Unpin,
Align1<u8>: Unpin,
Align8<u64>: Unpin,
Align8<usize>: Unpin,
Arc<SegmentManager>: Unpin,
*const LeafNode<String, Vec<ContextPosting>> is !null: Unpin,
Box<(String, Vec<ContextPosting>)>: Unpin,
*const LeafNode<(String, String), Vec<ContextPosting>> is !null: Unpin,
Box<((String, String), Vec<ContextPosting>)>: Unpin,
Arc<str>: Unpin,
Box<GraphNodeKind>: Unpin,
Box<GraphEdgeKind>: Unpin,
Box<TimeSeriesPointKind>: Unpin,
Arc<CronSchedule>: Unpin,
Arc<Vec<String>>: Unpin,
Box<EntityAux>: Unpin,
Box<SqlTypeName>: Unpin,
Arc<Expr>: Unpin,
Arc<[String]>: Unpin,
*const LeafNode<String, GraphVertexContract> is !null: Unpin,
Box<(String, GraphVertexContract)>: Unpin,
*const LeafNode<String, GraphEdgeContract> is !null: Unpin,
Box<(String, GraphEdgeContract)>: Unpin,
ResidentStore: Unpin,
impl<F> UnsafeUnpin for LocalDatabase<F>where
F: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
Align8<u64>: UnsafeUnpin,
Align8<usize>: UnsafeUnpin,
PhantomData<(String, Arc<SegmentManager>)>: UnsafeUnpin,
PhantomData<(EntityId, Vec<(EntityId, RefType, String)>)>: UnsafeUnpin,
*const LeafNode<String, Vec<ContextPosting>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Vec<ContextPosting>)>>: UnsafeUnpin,
*const LeafNode<(String, String), Vec<ContextPosting>> is !null: UnsafeUnpin,
PhantomData<Box<((String, String), Vec<ContextPosting>)>>: UnsafeUnpin,
PhantomData<(u64, EntityKeys)>: UnsafeUnpin,
PhantomData<(u64, ())>: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
PhantomData<(u64, (String, UnifiedEntity))>: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
PhantomData<((String, String), Vec<EntityId>)>: UnsafeUnpin,
PhantomData<(String, CollectionContract)>: UnsafeUnpin,
ResidentStore: UnsafeUnpin,
PhantomData<StoreWalAction>: UnsafeUnpin,
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