Implement StorageBackend for SurrealDB

This commit is contained in:
Alejandro Cabeza Romero 2024-12-11 19:49:08 +01:00
parent 9e4abcd528
commit 9a16b724d5
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
2 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@ rocksdb = { version = "0.22", optional = true }
surrealdb = { version = "2.1.2", optional = true }
thiserror = "1.0"
tracing = "0.1"
serde_json = "1.0.133"
[dev-dependencies]
tokio = { version = "1", features = ["sync", "macros", "time"] }

View File

@ -112,7 +112,7 @@ where
async fn load(&mut self, key: &[u8]) -> Result<Option<Bytes>, Self::Error> {
let key = from_utf8(key)?;
let record: Option<Data> = self.db.select(("kv", key)).await?;
let record: Option<Data> = self.db.select(("kv", key)).await?; // TODO: Fix kv
Ok(record.as_ref().map(Data::to_bytes))
}
@ -146,7 +146,7 @@ mod tests {
use crate::backends::testing::NoStorageSerde;
use tokio::runtime::Handle;
fn get_test_config() -> SurrealBackendSettings {
pub fn get_test_config() -> SurrealBackendSettings {
let (sender, _) = tokio::sync::mpsc::channel(1);
SurrealBackendSettings::new(
String::from("mem://"),