pub struct ConnectionEnv { /* private fields */ }Expand description
Connection-scoped environment for selecting the runtime context and tuning resource limits.
§Page buffer pool sizing
By default the page-buffer pool is sized via the FSQLITE_PAGE_BUFFER_MAX
environment variable (if set), otherwise
DEFAULT_PAGE_BUFFER_MAX
(262 144 buffers ≈ 1 GiB at 4 KiB pages).
To override programmatically, call
set_page_buffer_max before opening a
connection:
let mut env = ConnectionEnv::default();
env.set_page_buffer_max(524_288); // 2 GiB at 4 KiB pages
let conn = Connection::open_with_env("big.db", env)?;Implementations§
Source§impl ConnectionEnv
impl ConnectionEnv
Sourcepub fn new(runtime: Arc<RuntimeContext>) -> Self
pub fn new(runtime: Arc<RuntimeContext>) -> Self
Create a connection environment from an explicit runtime context.
Sourcepub fn set_strict_multi_process(&mut self, strict: bool)
pub fn set_strict_multi_process(&mut self, strict: bool)
Enable strict multi-process mode for this connection env. With
strict mode on, the connection refuses to silently proceed past
concurrency contract violations (F_SETLK timeout, freelist
trunk page past db_size, WAL checkpoint contention at open) and
returns FrankenError::MultiProcessContractViolation instead.
See frankensqlite#81.
Sourcepub fn strict_multi_process(&self) -> bool
pub fn strict_multi_process(&self) -> bool
Returns whether strict multi-process refusal is enabled. See frankensqlite#81.
Sourcepub fn runtime(&self) -> &Arc<RuntimeContext> ⓘ
pub fn runtime(&self) -> &Arc<RuntimeContext> ⓘ
Access the runtime context that will back newly opened connections.
Sourcepub fn set_page_buffer_max(&mut self, max_buffers: impl Into<Option<usize>>)
pub fn set_page_buffer_max(&mut self, max_buffers: impl Into<Option<usize>>)
Override the maximum number of page buffers the pager’s buffer pool will allocate.
At the standard 4 KiB page size, each buffer consumes ~4 KiB, so
262_144 ≈ 1 GiB and 524_288 ≈ 2 GiB.
Pass None to revert to the default resolution (env var, then
compile-time default).
Sourcepub fn page_buffer_max(&self) -> Option<usize>
pub fn page_buffer_max(&self) -> Option<usize>
Returns the explicit page-buffer-pool ceiling, if one has been set.
Sourcepub fn set_memory_vfs_config(
&mut self,
config: impl Into<Option<MemoryVfsConfig>>,
)
pub fn set_memory_vfs_config( &mut self, config: impl Into<Option<MemoryVfsConfig>>, )
Override the MemoryVfs growth policy used for :memory: databases and
imported SQLite images.
File-backed connections ignore this setting.
Sourcepub fn memory_vfs_config(&self) -> Option<MemoryVfsConfig>
pub fn memory_vfs_config(&self) -> Option<MemoryVfsConfig>
Returns the explicit MemoryVfs configuration, if one has been set.
Trait Implementations§
Source§impl Clone for ConnectionEnv
impl Clone for ConnectionEnv
Source§fn clone(&self) -> ConnectionEnv
fn clone(&self) -> ConnectionEnv
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more