[][src]Trait unqlite::Config

pub trait Config {
    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; }

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

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.

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.

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.

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.

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.

fn kv_name(&self) -> String

Extract the name of the underlying Key/Value storage engine.

Here's some useful names to know: Hash, Mem, R+Tree, LSM, etc.

Loading content...

Implementors

impl Config for UnQLite[src]

Loading content...