fix: update octobase and fix type mismatching

This commit is contained in:
linonetwo
2023-01-09 15:09:49 +08:00
parent 5513cbf724
commit 51a427496c
9 changed files with 31 additions and 20 deletions
@@ -17,7 +17,7 @@ pub async fn get_doc<'s>(
.lock()
.await
.doc_storage
.get(parameters.id)
.get(parameters.id.clone())
.await
.ok()
{
@@ -27,7 +27,7 @@ pub async fn get_doc<'s>(
} else {
Err(format!(
"Failed to get yDoc from {}",
parameters.id.to_string()
parameters.id
))
}
}
@@ -42,7 +42,7 @@ pub async fn update_y_document<'s>(
.lock()
.await
.doc_storage
.write_update(parameters.id, &parameters.update)
.write_update(parameters.id.clone(), &parameters.update)
.await
.ok()
{
@@ -50,7 +50,7 @@ pub async fn update_y_document<'s>(
} else {
Err(format!(
"Failed to update yDoc to {}",
parameters.id.to_string()
parameters.id
))
}
}
@@ -19,7 +19,7 @@ pub async fn create_workspace<'s>(
.await
{
Ok(new_workspace) => {
let workspace_doc = OctoBaseWorkspace::new(new_workspace.id.to_string());
let workspace_doc = OctoBaseWorkspace::new(new_workspace.id.clone());
workspace_doc.with_trx(|mut workspace_doc_transaction| {
workspace_doc_transaction.set_metadata(
@@ -32,13 +32,13 @@ pub async fn create_workspace<'s>(
.lock()
.await
.doc_storage
.write_doc(new_workspace.id, workspace_doc.doc())
.write_doc(new_workspace.id.clone(), workspace_doc.doc())
.await
{
Err(error_message.to_string())
} else {
Ok(CreateWorkspaceResult {
id: new_workspace.id.to_string(),
id: new_workspace.id.clone(),
name: parameters.name,
})
}
+3 -3
View File
@@ -1,4 +1,4 @@
use jwst_storage::{BlobFsStorage, DBContext, DocFsStorage};
use jwst_storage::{BlobFsStorage, SqliteDBContext, DocFsStorage};
use std::path::Path;
use tauri::api::path::document_dir;
use tokio::sync::Mutex;
@@ -6,7 +6,7 @@ use tokio::sync::Mutex;
pub struct AppStateRaw {
pub blob_storage: BlobFsStorage,
pub doc_storage: DocFsStorage,
pub metadata_db: DBContext,
pub metadata_db: SqliteDBContext,
}
impl AppStateRaw {
@@ -27,7 +27,7 @@ impl AppStateRaw {
Some(Self {
doc_storage: DocFsStorage::new(Some(16), 500, Path::new(&doc_env).into()).await,
blob_storage: BlobFsStorage::new(Some(16), Path::new(&blob_env).into()).await,
metadata_db: DBContext::new(db_env).await,
metadata_db: SqliteDBContext::new(db_env).await,
})
}
}