mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor backend directory
This commit is contained in:
4
frontend/rust-lib/dart-ffi/src/protobuf/document
Normal file
4
frontend/rust-lib/dart-ffi/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
8
frontend/rust-lib/dart-ffi/src/protobuf/model/document
Normal file
8
frontend/rust-lib/dart-ffi/src/protobuf/model/document
Normal file
@ -0,0 +1,8 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod ffi_response;
|
||||
pub use ffi_response::*;
|
||||
|
||||
mod ffi_request;
|
||||
pub use ffi_request::*;
|
4
frontend/rust-lib/dart-notify/src/protobuf/document
Normal file
4
frontend/rust-lib/dart-notify/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
@ -0,0 +1,5 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod subject;
|
||||
pub use subject::*;
|
4
frontend/rust-lib/flowy-core/src/protobuf/document
Normal file
4
frontend/rust-lib/flowy-core/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
8
frontend/rust-lib/flowy-core/src/protobuf/model/document
Normal file
8
frontend/rust-lib/flowy-core/src/protobuf/model/document
Normal file
@ -0,0 +1,8 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod observable;
|
||||
pub use observable::*;
|
||||
|
||||
mod event;
|
||||
pub use event::*;
|
4
frontend/rust-lib/flowy-document/src/protobuf/document
Normal file
4
frontend/rust-lib/flowy-document/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
@ -0,0 +1,5 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod observable;
|
||||
pub use observable::*;
|
@ -56,7 +56,7 @@ impl DocController {
|
||||
}
|
||||
|
||||
pub(crate) fn close(&self, doc_id: &str) -> Result<(), FlowyError> {
|
||||
tracing::debug!("Close doc {}", doc_id);
|
||||
tracing::debug!("Close document {}", doc_id);
|
||||
self.open_cache.remove(doc_id);
|
||||
self.ws_handlers.remove_handler(doc_id);
|
||||
Ok(())
|
||||
@ -114,7 +114,7 @@ impl DocController {
|
||||
fn make_rev_manager(&self, doc_id: &str, pool: Arc<ConnectionPool>) -> Result<RevisionManager, FlowyError> {
|
||||
// Opti: require upgradable_read lock and then upgrade to write lock using
|
||||
// RwLockUpgradableReadGuard::upgrade(xx) of ws
|
||||
// let doc = self.read_doc(doc_id, pool.clone()).await?;
|
||||
// let document = self.read_doc(doc_id, pool.clone()).await?;
|
||||
let user_id = self.user.user_id()?;
|
||||
let cache = Arc::new(RevisionCache::new(&user_id, doc_id, pool));
|
||||
Ok(RevisionManager::new(&user_id, doc_id, cache))
|
||||
|
@ -20,7 +20,7 @@ use flowy_collaboration::{
|
||||
use flowy_error::{internal_error, FlowyError, FlowyResult};
|
||||
use lib_infra::future::FutureResult;
|
||||
use lib_ot::{
|
||||
revision::{RevType, Revision, RevisionRange},
|
||||
revision::{Revision, RevisionRange},
|
||||
rich_text::RichTextDelta,
|
||||
};
|
||||
use lib_ws::WSConnectState;
|
||||
@ -194,7 +194,7 @@ pub(crate) async fn handle_push_rev(
|
||||
bytes: Bytes,
|
||||
) -> FlowyResult<Option<Revision>> {
|
||||
// Transform the revision
|
||||
let (ret, rx) = oneshot::channel::<CollaborateResult<TransformDeltas>>();
|
||||
let (_ret, _rx) = oneshot::channel::<CollaborateResult<TransformDeltas>>();
|
||||
let revision = Revision::try_from(bytes)?;
|
||||
let delta = RichTextDelta::from_bytes(&revision.delta_data)?;
|
||||
let server_rev_id = revision.rev_id;
|
||||
@ -217,10 +217,10 @@ pub(crate) async fn handle_push_rev(
|
||||
ret,
|
||||
};
|
||||
let _ = edit_cmd_tx.send(msg);
|
||||
let md5 = rx.await.map_err(internal_error)??;
|
||||
let _md5 = rx.await.map_err(internal_error)??;
|
||||
|
||||
// update rev id
|
||||
rev_manager.update_rev_id_counter_value(server_rev_id.clone().into());
|
||||
rev_manager.update_rev_id_counter_value(server_rev_id);
|
||||
// let (local_base_rev_id, local_rev_id) = rev_manager.next_rev_id();
|
||||
// let delta_data = client_prime.to_bytes();
|
||||
// // save the revision
|
||||
|
@ -64,7 +64,7 @@ impl FileManager {
|
||||
pub(crate) fn create_file(&mut self, id: &str, dir: &str, text: &str) -> Result<PathBuf, FileError> {
|
||||
let path = PathBuf::from(format!("{}/{}", dir, id));
|
||||
let file_id: FileId = id.to_owned().into();
|
||||
tracing::info!("Create doc at: {:?}", path);
|
||||
tracing::info!("Create document at: {:?}", path);
|
||||
let _ = self.save_new(&path, text, &file_id)?;
|
||||
Ok(path)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ impl ResponseMiddleware for DocMiddleware {
|
||||
fn receive_response(&self, token: &Option<String>, response: &FlowyResponse) {
|
||||
if let Some(error) = &response.error {
|
||||
if error.is_unauthorized() {
|
||||
log::error!("doc user is unauthorized");
|
||||
log::error!("document user is unauthorized");
|
||||
|
||||
match token {
|
||||
None => {},
|
||||
|
4
frontend/rust-lib/flowy-error/src/protobuf/document
Normal file
4
frontend/rust-lib/flowy-error/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
@ -0,0 +1,5 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod errors;
|
||||
pub use errors::*;
|
4
frontend/rust-lib/flowy-net/src/protobuf/document
Normal file
4
frontend/rust-lib/flowy-net/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
8
frontend/rust-lib/flowy-net/src/protobuf/model/document
Normal file
8
frontend/rust-lib/flowy-net/src/protobuf/model/document
Normal file
@ -0,0 +1,8 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod network_state;
|
||||
pub use network_state::*;
|
||||
|
||||
mod event;
|
||||
pub use event::*;
|
@ -42,7 +42,7 @@ impl DocumentUser for DocumentUserImpl {
|
||||
.user_dir()
|
||||
.map_err(|e| FlowyError::unauthorized().context(e))?;
|
||||
|
||||
let doc_dir = format!("{}/doc", dir);
|
||||
let doc_dir = format!("{}/document", dir);
|
||||
if !Path::new(&doc_dir).exists() {
|
||||
let _ = std::fs::create_dir_all(&doc_dir)?;
|
||||
}
|
||||
|
4
frontend/rust-lib/flowy-user/src/protobuf/document
Normal file
4
frontend/rust-lib/flowy-user/src/protobuf/document
Normal file
@ -0,0 +1,4 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
mod model;
|
||||
pub use model::*;
|
8
frontend/rust-lib/flowy-user/src/protobuf/model/document
Normal file
8
frontend/rust-lib/flowy-user/src/protobuf/model/document
Normal file
@ -0,0 +1,8 @@
|
||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
||||
// Auto-generated, do not edit
|
||||
|
||||
mod observable;
|
||||
pub use observable::*;
|
||||
|
||||
mod event;
|
||||
pub use event::*;
|
Reference in New Issue
Block a user