Enable compression in sled
Diff
Cargo.lock | 30 ++++++++++++++++++++++++++++++
Cargo.toml | 2 +-
src/main.rs | 6 +++++-
3 files changed, 36 insertions(+), 2 deletions(-)
@@ -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",
]
@@ -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"] }
@@ -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();