BROKEN start of prototyping
This commit is contained in:
commit
900122d131
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/target
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
.idea
|
23
Cargo.toml
Normal file
23
Cargo.toml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[package]
|
||||||
|
name = "fancy_mdbx"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.56"
|
||||||
|
|
||||||
|
log = "0.4.16"
|
||||||
|
|
||||||
|
thiserror = "1.0.30"
|
||||||
|
|
||||||
|
libmdbx = "0.1.1"
|
||||||
|
|
||||||
|
# 0.11.1+zstd.1.5.2
|
||||||
|
zstd = "0.11.1"
|
||||||
|
|
||||||
|
serde = "1.0.136"
|
||||||
|
serde_bare = "0.5.0"
|
||||||
|
|
||||||
|
ouroboros = "0.14.2"
|
30
src/environment.rs
Normal file
30
src/environment.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
use libmdbx::{Database, Environment, EnvironmentKind, WriteMap};
|
||||||
|
|
||||||
|
pub struct Env {
|
||||||
|
pub mdbx_env: Environment<WriteMap>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[self_referencing]
|
||||||
|
pub struct Table {
|
||||||
|
pub mdbx_env: Arc<Env>,
|
||||||
|
|
||||||
|
#[borrows(mdbx_env)]
|
||||||
|
#[covariant]
|
||||||
|
pub mdbx_db: Database<'this>
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// - raw if wanted
|
||||||
|
// - serde if wanted
|
||||||
|
// - compression if wanted
|
||||||
|
// - ??? does it make sense to offer ALL these things in one interface; could the raw stuff
|
||||||
|
// be done slightly differently?
|
||||||
|
|
||||||
|
impl Env {
|
||||||
|
pub fn open_table(&self, name: &str, flags: ()) -> anyhow::Result<Table> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn open_
|
||||||
|
}
|
11
src/lib.rs
Normal file
11
src/lib.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
mod environment;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
let result = 2 + 2;
|
||||||
|
assert_eq!(result, 4);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user