chore: upgrade to fjall 3
This commit is contained in:
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user