From 4dc5fc9d8039035e9af01e4c04b9c865f0b3bf6e Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 17 Jul 2022 21:54:33 +0100 Subject: [PATCH] Enable compression in sled --- 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(); -- rgit 0.1.3