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

View File

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

View File

@@ -1,6 +1,6 @@
pub use bytes::Bytes;
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 snafu::{OptionExt, ResultExt, Snafu};
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>>(
partition: Partition,
keyspace: Keyspace,
identifier: Bytes,
buffer: NonZeroUsize,
) -> (
@@ -32,9 +32,9 @@ pub async fn persisted<T: Debug + Send + Sync + 'static + Serialize + for<'a> De
impl Future<Output = Result<(), JoinError>>,
) {
let initial = spawn_blocking({
let partition = partition.clone();
let keyspace = keyspace.clone();
let identifier = identifier.clone();
move || partition.get(identifier.deref())
move || keyspace.get(identifier.deref())
})
.await
.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
let persisted_res = match serialized_res {
Ok(serialized) => spawn_blocking({
let partition = partition.clone();
let keyspace = keyspace.clone();
let identifier = identifier.clone();
move || partition.insert(identifier.deref(), serialized)
move || keyspace.insert(identifier.deref(), serialized)
}).await.unwrap().context(SavingSnafu),
Err(error) => Err(error),
};