pub struct SqliteWorkerHandle { /* private fields */ }Implementations§
Source§impl SqliteWorkerHandle
impl SqliteWorkerHandle
Sourcepub fn start(
vfs: NativeVfsHandle,
file_name: String,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
) -> Result<Self>
pub fn start( vfs: NativeVfsHandle, file_name: String, metrics: Option<Arc<dyn SqliteVfsMetrics>>, ) -> Result<Self>
Runs the database on a dedicated single-thread pool, for callers without a shared one.
Sourcepub fn start_on(
pool: &SqlitePool,
vfs: NativeVfsHandle,
file_name: String,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
) -> Result<Self>
pub fn start_on( pool: &SqlitePool, vfs: NativeVfsHandle, file_name: String, metrics: Option<Arc<dyn SqliteVfsMetrics>>, ) -> Result<Self>
Registers the database with pool. A pool thread opens the connection; wait_ready
reports the outcome.
Sourcepub fn start_on_with_guard(
pool: &SqlitePool,
vfs: NativeVfsHandle,
file_name: String,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
guard: Option<ConnectionGuard>,
) -> Result<Self>
pub fn start_on_with_guard( pool: &SqlitePool, vfs: NativeVfsHandle, file_name: String, metrics: Option<Arc<dyn SqliteVfsMetrics>>, guard: Option<ConnectionGuard>, ) -> Result<Self>
Like SqliteWorkerHandle::start_on, with guard installed on the connection and its
work budget reset before every command.
pub async fn wait_ready(&self) -> Result<()>
Sourcepub fn set_background(&self, background: bool)
pub fn set_background(&self, background: bool)
Returns whether the connection has an open explicit transaction, such as
one started by a manual BEGIN, as of the last completed command.
Marks this database’s later work as background work, which the pool runs after
foreground work. Set when its actor starts shutting down.
pub fn explicit_transaction_open(&self) -> bool
Sourcepub fn subscribe_explicit_transaction(&self) -> Receiver<bool>
pub fn subscribe_explicit_transaction(&self) -> Receiver<bool>
Subscribes to explicit transaction state changes. The value changes before the reply of the command that changed it is delivered.
pub async fn exec(&self, sql: String) -> Result<QueryResult>
pub async fn exec_profiled( &self, sql: String, ) -> Result<SqliteWorkerResult<QueryResult>>
pub async fn execute( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<ExecuteResult>
pub async fn execute_profiled( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<SqliteWorkerResult<ExecuteResult>>
Sourcepub async fn execute_batch(
&self,
statements: Vec<(String, Option<Vec<BindParam>>)>,
) -> Result<Vec<ExecuteResult>>
pub async fn execute_batch( &self, statements: Vec<(String, Option<Vec<BindParam>>)>, ) -> Result<Vec<ExecuteResult>>
Runs statements in order as one command, so they take one turn on the pool instead of
one turn each. Statements after the first failure do not run. The batch does not open a
transaction of its own: run it inside an explicit transaction for atomicity.
Sourcepub async fn cork_commits(&self) -> Result<()>
pub async fn cork_commits(&self) -> Result<()>
Holds every later commit in memory until uncork_commits, which sends them to depot as
one commit. Commands queue in order, so the transactions after this call are the ones
held. None of them is durable until uncorking succeeds.
Sourcepub async fn uncork_commits(&self) -> Result<()>
pub async fn uncork_commits(&self) -> Result<()>
Sends the transactions committed since cork_commits to depot as one commit. Inside an
explicit transaction it waits until the transaction ends, so the commit includes it.
pub async fn close(&self) -> Result<()>
Sourcepub async fn close_and_wait(&self) -> Result<()>
pub async fn close_and_wait(&self) -> Result<()>
Closes the database and waits, without a timeout, until no pool thread holds it.