pub trait Config {
// Required methods
fn max_page_cache(self, max: u32) -> Self;
fn disable_auto_commit(self) -> Self;
fn kv_engine<S: Into<Vec<u8>>>(self, name: S) -> Self;
fn err_log(&self) -> Option<String>;
fn jx9_err_log(&self) -> Option<String>;
fn kv_name(&self) -> String;
}
Expand description
A Trait
for configuration.
This part of functions is about UnQLite’s config options.
The list is token from unqlite_config
function, see also here.
§Usage
let unqlite = UnQLite::create_temp()
.max_page_cache(4096u32)
.disable_auto_commit();
println!("KV engine name: {}", unqlite.kv_name());
// Extract error logs
unqlite.err_log().map(|log| panic!(log));
Required Methods§
Sourcefn max_page_cache(self, max: u32) -> Self
fn max_page_cache(self, max: u32) -> Self
Maximum raw pages to cache in memory.
This is a simple hint, UnQLite is not forced to honor it.
Sourcefn disable_auto_commit(self) -> Self
fn disable_auto_commit(self) -> Self
To diable automatically commit action.
Normally, If unqlite_close()
is invoked while a transaction is open, the transaction is
automatically committed. But, if this option is set, then the transaction is automatically
rolled back and you should call unqlite_commit()
manually to commit all database changes.
Sourcefn kv_engine<S: Into<Vec<u8>>>(self, name: S) -> Self
fn kv_engine<S: Into<Vec<u8>>>(self, name: S) -> Self
Switch to another Key/Value storage engine.
Offical document says: This option is reserved for future usage.
There is some unknown bug in setting this, DO NOT use this option currently.
Sourcefn err_log(&self) -> Option<String>
fn err_log(&self) -> Option<String>
The database error log is stored in an internal buffer. When something goes wrong during a commit, rollback, store, append operation, a human-readable error message is generated to help clients diagnose the problem. This option can be used to point to that buffer.
Sourcefn jx9_err_log(&self) -> Option<String>
fn jx9_err_log(&self) -> Option<String>
When something goes wrong during compilation of the target Jx9 script due to an erroneous Jx9 code, the compiler error log is redirected to an internal buffer. This option can be used to point to that buffer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.