cargo update

This commit is contained in:
Sebastian Moser
2023-04-13 14:49:11 +02:00
parent 04787827f4
commit e9af27f6f1
6 changed files with 833 additions and 1538 deletions

View File

@@ -1,7 +1,7 @@
use std::net::ToSocketAddrs;
use std::{io, fmt::format, vec};
use surrealdb::{Datastore, Key, Val};
use surrealdb::kvs::{Datastore, Key, Val};
use itertools::Itertools;
use crate::error;
use crate::error::MizeError;
@@ -17,7 +17,7 @@ use super::proto::Delta;
// is responsible, that no illegal states can occur in the storage, by using transactions
// currently it's just a surrealdb Datastore. should be replaced by a completely custom File-System in the future.
pub struct Itemstore {
db: surrealdb::Datastore,
db: Datastore,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -93,8 +93,9 @@ impl Item {
impl Itemstore {
pub async fn new(path: String) -> Result<Itemstore, MizeError> {
let ds = Datastore::new(&(String::from("file://") + &path[..] + "/db")[..]).await
.map_err(|_| MizeError::new(30).format(vec![&path]))?;
println!("PATH of DB: {}", path);
let ds = Datastore::new(&(String::from("file://") + &path[..])[..]).await
.map_err(|e| MizeError::new(30).extra_msg(format!("surrealdb Error: {}", e)).extra_msg(format!("Trying to create at Location: {}", path)))?;
let mut tr = ds.transaction(true, false).await?;

View File

@@ -332,7 +332,10 @@ pub async fn handle_json_msg(msg: JsonMessage, origin: Peer, mutexes: Mutexes) -
for (id, delta) in new_update {
//send that delta to every origin that is subbed the item
let peers = subs.get(&id).ok_or(MizeError::new(11))?;
let peers = match subs.get(&id) {
Some(vec) => vec,
None => continue,
};
let message = UpdateMessage{id, delta};
for peer in peers {