chore: upgrade to fjall 3

This commit is contained in:
J / Jacob Babich
2026-07-15 00:13:47 -04:00
parent 83b35908f7
commit 224ee7732f
3 changed files with 56 additions and 76 deletions

118
Cargo.lock generated
View File

@@ -234,6 +234,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "byteorder-lite"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.12.1" version = "1.12.1"
@@ -242,9 +248,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]] [[package]]
name = "byteview" name = "byteview"
version = "0.6.1" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6236364b88b9b6d0bc181ba374cf1ab55ba3ef97a1cb6f8cddad48a273767fb5" checksum = "1c53ba0f290bfc610084c05582d9c5d421662128fc69f4bf236707af6fd321b9"
[[package]] [[package]]
name = "cc" name = "cc"
@@ -596,12 +602,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "double-ended-peekable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0d05e1c0dbad51b52c38bda7adceef61b9efc2baf04acfe8726a8c4630a6f57"
[[package]] [[package]]
name = "driver-kasa" name = "driver-kasa"
version = "0.1.0" version = "0.1.0"
@@ -723,21 +723,30 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]] [[package]]
name = "fjall" name = "fjall"
version = "2.11.2" version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b25ad44cd4360a0448a9b5a0a6f1c7a621101cca4578706d43c9a821418aebc" checksum = "9fcdc69609906151dff9b534e30eaf8515082055d36f628e382bd0b5d6a1d362"
dependencies = [ dependencies = [
"byteorder", "byteorder-lite",
"byteview", "byteview",
"dashmap 6.2.1", "dashmap 6.2.1",
"flume",
"log", "log",
"lsm-tree", "lsm-tree",
"path-absolutize", "lz4_flex",
"std-semaphore",
"tempfile", "tempfile",
"xxhash-rust", "xxhash-rust",
] ]
[[package]]
name = "flume"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"
dependencies = [
"spin",
]
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.2.2" version = "1.2.2"
@@ -872,12 +881,6 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "guardian"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17e2ac29387b1aa07a1e448f7bb4f35b500787971e965b02842b900afa5c8f6f"
[[package]] [[package]]
name = "hash32" name = "hash32"
version = "0.2.1" version = "0.2.1"
@@ -1413,33 +1416,34 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]] [[package]]
name = "lsm-tree" name = "lsm-tree"
version = "2.10.4" version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "799399117a2bfb37660e08be33f470958babb98386b04185288d829df362ea15" checksum = "39ca67401338b98d58447387dd5230552d2241bc388206e491d137b18dfea9d6"
dependencies = [ dependencies = [
"byteorder", "byteorder-lite",
"byteview",
"crossbeam-skiplist", "crossbeam-skiplist",
"double-ended-peekable",
"enum_dispatch", "enum_dispatch",
"guardian",
"interval-heap", "interval-heap",
"log", "log",
"lz4_flex", "lz4_flex",
"path-absolutize",
"quick_cache", "quick_cache",
"rustc-hash", "rustc-hash",
"self_cell", "self_cell",
"sfa",
"tempfile", "tempfile",
"value-log",
"varint-rs", "varint-rs",
"xxhash-rust", "xxhash-rust",
] ]
[[package]] [[package]]
name = "lz4_flex" name = "lz4_flex"
version = "0.11.6" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373f5eceeeab7925e0c1098212f2fbc4d416adec9d35051a6ab251e824c1854a" checksum = "7ef0d4ed8669f8f8826eb00dc878084aa8f253506c4fd5e8f58f5bce72ddb97e"
dependencies = [
"twox-hash",
]
[[package]] [[package]]
name = "mac_address" name = "mac_address"
@@ -1590,24 +1594,6 @@ dependencies = [
"windows-link", "windows-link",
] ]
[[package]]
name = "path-absolutize"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5"
dependencies = [
"path-dedot",
]
[[package]]
name = "path-dedot"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.2" version = "2.3.2"
@@ -2143,6 +2129,17 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "sfa"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1296838937cab56cd6c4eeeb8718ec777383700c33f060e2869867bd01d1175"
dependencies = [
"byteorder-lite",
"log",
"xxhash-rust",
]
[[package]] [[package]]
name = "shadow-rs" name = "shadow-rs"
version = "2.0.0" version = "2.0.0"
@@ -2272,12 +2269,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "std-semaphore"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e"
[[package]] [[package]]
name = "string-literal" name = "string-literal"
version = "0.1.0" version = "0.1.0"
@@ -2589,6 +2580,12 @@ dependencies = [
"tracing-log", "tracing-log",
] ]
[[package]]
name = "twox-hash"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c"
[[package]] [[package]]
name = "typed-builder" name = "typed-builder"
version = "0.23.2" version = "0.23.2"
@@ -2683,23 +2680,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "value-log"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62fc7c4ce161f049607ecea654dca3f2d727da5371ae85e2e4f14ce2b98ed67c"
dependencies = [
"byteorder",
"byteview",
"interval-heap",
"log",
"path-absolutize",
"rustc-hash",
"tempfile",
"varint-rs",
"xxhash-rust",
]
[[package]] [[package]]
name = "varint-rs" name = "varint-rs"
version = "2.2.1" version = "2.2.1"

View File

@@ -7,7 +7,7 @@ license.workspace = true
[dependencies] [dependencies]
bytes = { workspace = true } bytes = { workspace = true }
emitter-and-signal = { path = "../emitter-and-signal" } emitter-and-signal = { path = "../emitter-and-signal" }
fjall = "2" fjall = "3"
postcard = { version = "1.1", features = ["use-std"] } postcard = { version = "1.1", features = ["use-std"] }
serde = { workspace = true } serde = { workspace = true }
snafu = { workspace = true } snafu = { workspace = true }

View File

@@ -1,6 +1,6 @@
pub use bytes::Bytes; pub use bytes::Bytes;
use emitter_and_signal::signal::{JoinError, Signal}; use emitter_and_signal::signal::{JoinError, Signal};
pub use fjall::{Config, Keyspace, Partition, PartitionCreateOptions}; pub use fjall::{Config, Database, Keyspace, KeyspaceCreateOptions};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use snafu::{OptionExt, ResultExt, Snafu}; use snafu::{OptionExt, ResultExt, Snafu};
use std::{fmt::Debug, future::Future, num::NonZeroUsize, ops::Deref, sync::Arc}; use std::{fmt::Debug, future::Future, num::NonZeroUsize, ops::Deref, sync::Arc};
@@ -23,7 +23,7 @@ pub enum PersistedError {
} }
pub async fn persisted<T: Debug + Send + Sync + 'static + Serialize + for<'a> Deserialize<'a>>( pub async fn persisted<T: Debug + Send + Sync + 'static + Serialize + for<'a> Deserialize<'a>>(
partition: Partition, keyspace: Keyspace,
identifier: Bytes, identifier: Bytes,
buffer: NonZeroUsize, buffer: NonZeroUsize,
) -> ( ) -> (
@@ -32,9 +32,9 @@ pub async fn persisted<T: Debug + Send + Sync + 'static + Serialize + for<'a> De
impl Future<Output = Result<(), JoinError>>, impl Future<Output = Result<(), JoinError>>,
) { ) {
let initial = spawn_blocking({ let initial = spawn_blocking({
let partition = partition.clone(); let keyspace = keyspace.clone();
let identifier = identifier.clone(); let identifier = identifier.clone();
move || partition.get(identifier.deref()) move || keyspace.get(identifier.deref())
}) })
.await .await
.unwrap() .unwrap()
@@ -60,9 +60,9 @@ pub async fn persisted<T: Debug + Send + Sync + 'static + Serialize + for<'a> De
// Stand-in for Option::async_and_then // Stand-in for Option::async_and_then
let persisted_res = match serialized_res { let persisted_res = match serialized_res {
Ok(serialized) => spawn_blocking({ Ok(serialized) => spawn_blocking({
let partition = partition.clone(); let keyspace = keyspace.clone();
let identifier = identifier.clone(); let identifier = identifier.clone();
move || partition.insert(identifier.deref(), serialized) move || keyspace.insert(identifier.deref(), serialized)
}).await.unwrap().context(SavingSnafu), }).await.unwrap().context(SavingSnafu),
Err(error) => Err(error), Err(error) => Err(error),
}; };