pub struct Kimberlite { /* private fields */ }Expand description
The main Kimberlite database handle.
Provides the top-level API for interacting with the database.
Get tenant-scoped access via the tenant() method.
§Example
ⓘ
use kimberlite::Kimberlite;
let db = Kimberlite::open("./data")?;
let tenant = db.tenant(TenantId::new(1));
// Use tenant handle for operations
tenant.execute("INSERT INTO users (id, name) VALUES ($1, $2)", &[1.into(), "Alice".into()])?;
let results = tenant.query("SELECT * FROM users WHERE id = $1", &[1.into()])?;Implementations§
Source§impl Kimberlite
impl Kimberlite
Sourcepub fn open(data_dir: impl AsRef<Path>) -> Result<Self>
pub fn open(data_dir: impl AsRef<Path>) -> Result<Self>
Opens a Kimberlite database at the given path.
If the directory doesn’t exist, it will be created. If the database already exists, it will be opened and state recovered.
Sourcepub fn open_with_config(config: KimberliteConfig) -> Result<Self>
pub fn open_with_config(config: KimberliteConfig) -> Result<Self>
Opens a Kimberlite database with custom configuration.
Sourcepub fn tenant(&self, id: TenantId) -> TenantHandle
pub fn tenant(&self, id: TenantId) -> TenantHandle
Returns a tenant-scoped handle.
The tenant handle provides operations scoped to a specific tenant ID.
Sourcepub fn submit(&self, command: Command) -> Result<()>
pub fn submit(&self, command: Command) -> Result<()>
Submits a command to the kernel and executes resulting effects.
This is the core write path: command → kernel → effects → I/O.
Sourcepub fn log_position(&self) -> Result<Offset>
pub fn log_position(&self) -> Result<Offset>
Returns the current log position.
Sourcepub fn projection_position(&self) -> Result<Offset>
pub fn projection_position(&self) -> Result<Offset>
Returns the current projection store position.
Trait Implementations§
Source§impl Clone for Kimberlite
impl Clone for Kimberlite
Source§fn clone(&self) -> Kimberlite
fn clone(&self) -> Kimberlite
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Kimberlite
impl RefUnwindSafe for Kimberlite
impl Send for Kimberlite
impl Sync for Kimberlite
impl Unpin for Kimberlite
impl UnwindSafe for Kimberlite
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
Mutably borrows from an owned value. Read more