🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2022-07-17 21:54:33.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-07-17 21:54:33.0 +01:00:00
commit
4dc5fc9d8039035e9af01e4c04b9c865f0b3bf6e [patch]
tree
06b72c9b1e995aab7b7da8d03499fb98d7f866e0
parent
a568bf659d337cde7efdc6e64e0c66f5ba673003
download
4dc5fc9d8039035e9af01e4c04b9c865f0b3bf6e.tar.gz

Enable compression in sled



Diff

 Cargo.lock  | 30 ++++++++++++++++++++++++++++++
 Cargo.toml  |  2 +-
 src/main.rs |  6 +++++-
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 22eda4e..b150182 100644
--- a/Cargo.lock
+++ a/Cargo.lock
@@ -1912,6 +1912,7 @@
 "libc",
 "log",
 "parking_lot 0.11.2",
 "zstd",
]

[[package]]
@@ -2541,4 +2542,33 @@
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
 "linked-hash-map",
]

[[package]]
name = "zstd"
version = "0.9.2+zstd.1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54"
dependencies = [
 "zstd-safe",
]

[[package]]
name = "zstd-safe"
version = "4.1.3+zstd.1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79"
dependencies = [
 "libc",
 "zstd-sys",
]

[[package]]
name = "zstd-sys"
version = "1.6.2+zstd.1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2daf2f248d9ea44454bfcb2516534e8b8ad2fc91bf818a1885495fc42bc8ac9f"
dependencies = [
 "cc",
 "libc",
]
diff --git a/Cargo.toml b/Cargo.toml
index 2409754..26719fc 100644
--- a/Cargo.toml
+++ a/Cargo.toml
@@ -21,7 +21,7 @@
parking_lot = "0.12"
serde = { version = "1.0", features = ["derive"] }
syntect = "5"
sled = "0.34"
sled = { version = "0.34", features = ["compression"] }
time = { version = "0.3", features = ["serde"] }
timeago = "0.3"
tokio = { version = "1.19", features = ["full"] }
diff --git a/src/main.rs b/src/main.rs
index c55e9ba..1f6a0f7 100644
--- a/src/main.rs
+++ a/src/main.rs
@@ -30,7 +30,11 @@
    let subscriber = subscriber.pretty();
    subscriber.init();

    let db = sled::open("/tmp/some-sled.db").unwrap();
    let db = sled::Config::default()
        .use_compression(true)
        .path("/tmp/some-sled.db")
        .open()
        .unwrap();

    std::thread::spawn({
        let db = db.clone();