mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: remove unuse crate references
This commit is contained in:
parent
248473dddf
commit
680d130986
@ -115,12 +115,6 @@ script = [
|
|||||||
echo PRODUCT_EXT: ${PRODUCT_EXT}
|
echo PRODUCT_EXT: ${PRODUCT_EXT}
|
||||||
echo APP_ENVIRONMENT: ${APP_ENVIRONMENT}
|
echo APP_ENVIRONMENT: ${APP_ENVIRONMENT}
|
||||||
echo ${platforms}
|
echo ${platforms}
|
||||||
|
|
||||||
echo "-------- Flutter --------"
|
|
||||||
flutter doctor
|
|
||||||
|
|
||||||
echo "-------- Rust --------"
|
|
||||||
rustup show
|
|
||||||
'''
|
'''
|
||||||
]
|
]
|
||||||
script_runner = "@shell"
|
script_runner = "@shell"
|
||||||
|
@ -26,10 +26,7 @@ once_cell = "1"
|
|||||||
lib-dispatch = {path = "../lib-dispatch" }
|
lib-dispatch = {path = "../lib-dispatch" }
|
||||||
flowy-sdk = {path = "../flowy-sdk"}
|
flowy-sdk = {path = "../flowy-sdk"}
|
||||||
dart-notify = {path = "../dart-notify" }
|
dart-notify = {path = "../dart-notify" }
|
||||||
|
|
||||||
flowy-derive = {path = "../../../shared-lib/flowy-derive" }
|
flowy-derive = {path = "../../../shared-lib/flowy-derive" }
|
||||||
backend-service = { path = "../../../shared-lib/backend-service" }
|
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
flutter = ["dart-notify/dart"]
|
flutter = ["dart-notify/dart"]
|
||||||
|
@ -8,7 +8,9 @@ use crate::{
|
|||||||
c::{extend_front_four_bytes_into_bytes, forget_rust},
|
c::{extend_front_four_bytes_into_bytes, forget_rust},
|
||||||
model::{FFIRequest, FFIResponse},
|
model::{FFIRequest, FFIResponse},
|
||||||
};
|
};
|
||||||
|
use flowy_sdk::get_client_server_configuration;
|
||||||
use flowy_sdk::*;
|
use flowy_sdk::*;
|
||||||
|
use lib_dispatch::prelude::ToBytes;
|
||||||
use lib_dispatch::prelude::*;
|
use lib_dispatch::prelude::*;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use std::{ffi::CStr, os::raw::c_char};
|
use std::{ffi::CStr, os::raw::c_char};
|
||||||
@ -80,9 +82,6 @@ pub extern "C" fn set_stream_port(port: i64) -> i32 {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn link_me_please() {}
|
pub extern "C" fn link_me_please() {}
|
||||||
|
|
||||||
use backend_service::configuration::get_client_server_configuration;
|
|
||||||
use lib_dispatch::prelude::ToBytes;
|
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
async fn post_to_flutter(response: EventResponse, port: i64) {
|
async fn post_to_flutter(response: EventResponse, port: i64) {
|
||||||
let isolate = allo_isolate::Isolate::new(port);
|
let isolate = allo_isolate::Isolate::new(port);
|
||||||
|
@ -18,17 +18,17 @@ use lib_infra::future::FutureResult;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
|
|
||||||
pub struct CoreHttpCloudService {
|
pub struct FolderHttpCloudService {
|
||||||
config: ClientServerConfiguration,
|
config: ClientServerConfiguration,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CoreHttpCloudService {
|
impl FolderHttpCloudService {
|
||||||
pub fn new(config: ClientServerConfiguration) -> CoreHttpCloudService {
|
pub fn new(config: ClientServerConfiguration) -> FolderHttpCloudService {
|
||||||
Self { config }
|
Self { config }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FolderCouldServiceV1 for CoreHttpCloudService {
|
impl FolderCouldServiceV1 for FolderHttpCloudService {
|
||||||
fn init(&self) {}
|
fn init(&self) {}
|
||||||
|
|
||||||
fn create_workspace(&self, token: &str, params: CreateWorkspaceParams) -> FutureResult<Workspace, FlowyError> {
|
fn create_workspace(&self, token: &str, params: CreateWorkspaceParams) -> FutureResult<Workspace, FlowyError> {
|
||||||
|
@ -6,3 +6,5 @@ pub mod local_server;
|
|||||||
pub mod module;
|
pub mod module;
|
||||||
pub mod protobuf;
|
pub mod protobuf;
|
||||||
pub mod ws;
|
pub mod ws;
|
||||||
|
|
||||||
|
pub use backend_service::configuration::{get_client_server_configuration, ClientServerConfiguration};
|
||||||
|
@ -26,7 +26,6 @@ parking_lot = "0.11"
|
|||||||
|
|
||||||
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration" }
|
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration" }
|
||||||
lib-ws = { path = "../../../shared-lib/lib-ws" }
|
lib-ws = { path = "../../../shared-lib/lib-ws" }
|
||||||
backend-service = { path = "../../../shared-lib/backend-service" }
|
|
||||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use backend_service::configuration::ClientServerConfiguration;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
|
use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
|
||||||
use flowy_database::ConnectionPool;
|
use flowy_database::ConnectionPool;
|
||||||
@ -6,6 +5,7 @@ use flowy_document::{
|
|||||||
errors::{internal_error, FlowyError},
|
errors::{internal_error, FlowyError},
|
||||||
DocumentCloudService, DocumentUser, FlowyDocumentManager,
|
DocumentCloudService, DocumentUser, FlowyDocumentManager,
|
||||||
};
|
};
|
||||||
|
use flowy_net::ClientServerConfiguration;
|
||||||
use flowy_net::{
|
use flowy_net::{
|
||||||
http_server::document::DocumentHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
|
http_server::document::DocumentHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use backend_service::configuration::ClientServerConfiguration;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
|
use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
|
||||||
use flowy_database::ConnectionPool;
|
use flowy_database::ConnectionPool;
|
||||||
@ -8,8 +7,9 @@ use flowy_folder::{
|
|||||||
errors::{internal_error, FlowyError},
|
errors::{internal_error, FlowyError},
|
||||||
event_map::{FolderCouldServiceV1, WorkspaceDatabase, WorkspaceUser},
|
event_map::{FolderCouldServiceV1, WorkspaceDatabase, WorkspaceUser},
|
||||||
};
|
};
|
||||||
|
use flowy_net::ClientServerConfiguration;
|
||||||
use flowy_net::{
|
use flowy_net::{
|
||||||
http_server::core::CoreHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
|
http_server::core::FolderHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
|
||||||
};
|
};
|
||||||
use flowy_sync::{RevisionWebSocket, WSStateReceiver};
|
use flowy_sync::{RevisionWebSocket, WSStateReceiver};
|
||||||
use flowy_user::services::UserSession;
|
use flowy_user::services::UserSession;
|
||||||
@ -31,7 +31,7 @@ impl FolderDepsResolver {
|
|||||||
let database: Arc<dyn WorkspaceDatabase> = Arc::new(WorkspaceDatabaseImpl(user_session));
|
let database: Arc<dyn WorkspaceDatabase> = Arc::new(WorkspaceDatabaseImpl(user_session));
|
||||||
let web_socket = Arc::new(FolderWebSocketImpl(ws_conn.clone()));
|
let web_socket = Arc::new(FolderWebSocketImpl(ws_conn.clone()));
|
||||||
let cloud_service: Arc<dyn FolderCouldServiceV1> = match local_server {
|
let cloud_service: Arc<dyn FolderCouldServiceV1> = match local_server {
|
||||||
None => Arc::new(CoreHttpCloudService::new(server_config.clone())),
|
None => Arc::new(FolderHttpCloudService::new(server_config.clone())),
|
||||||
Some(local_server) => local_server,
|
Some(local_server) => local_server,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use backend_service::configuration::ClientServerConfiguration;
|
use flowy_net::ClientServerConfiguration;
|
||||||
use flowy_net::{http_server::user::UserHttpCloudService, local_server::LocalServer};
|
use flowy_net::{http_server::user::UserHttpCloudService, local_server::LocalServer};
|
||||||
use flowy_user::event_map::UserCloudService;
|
use flowy_user::event_map::UserCloudService;
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
mod deps_resolve;
|
mod deps_resolve;
|
||||||
pub mod module;
|
pub mod module;
|
||||||
|
pub use flowy_net::get_client_server_configuration;
|
||||||
|
|
||||||
use crate::deps_resolve::*;
|
use crate::deps_resolve::*;
|
||||||
use backend_service::configuration::ClientServerConfiguration;
|
use flowy_document::FlowyDocumentManager;
|
||||||
use flowy_folder::{controller::FolderManager, errors::FlowyError};
|
use flowy_folder::{controller::FolderManager, errors::FlowyError};
|
||||||
|
use flowy_net::ClientServerConfiguration;
|
||||||
use flowy_net::{
|
use flowy_net::{
|
||||||
entities::NetworkType,
|
entities::NetworkType,
|
||||||
local_server::LocalServer,
|
local_server::LocalServer,
|
||||||
@ -10,8 +13,6 @@ use flowy_net::{
|
|||||||
};
|
};
|
||||||
use flowy_user::services::{notifier::UserStatus, UserSession, UserSessionConfig};
|
use flowy_user::services::{notifier::UserStatus, UserSession, UserSessionConfig};
|
||||||
use lib_dispatch::prelude::*;
|
use lib_dispatch::prelude::*;
|
||||||
|
|
||||||
use flowy_document::FlowyDocumentManager;
|
|
||||||
use lib_dispatch::util::tokio_default_runtime;
|
use lib_dispatch::util::tokio_default_runtime;
|
||||||
use module::mk_modules;
|
use module::mk_modules;
|
||||||
pub use module::*;
|
pub use module::*;
|
||||||
|
@ -13,7 +13,6 @@ flowy-folder = { path = "../flowy-folder", default-features = false}
|
|||||||
lib-dispatch = { path = "../lib-dispatch" }
|
lib-dispatch = { path = "../lib-dispatch" }
|
||||||
|
|
||||||
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration" }
|
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration" }
|
||||||
backend-service = { path = "../../../shared-lib/backend-service" }
|
|
||||||
lib-ot = { path = "../../../shared-lib/lib-ot" }
|
lib-ot = { path = "../../../shared-lib/lib-ot" }
|
||||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ pub mod event_builder;
|
|||||||
pub mod helper;
|
pub mod helper;
|
||||||
|
|
||||||
use crate::helper::*;
|
use crate::helper::*;
|
||||||
use backend_service::configuration::{get_client_server_configuration, ClientServerConfiguration};
|
use flowy_net::{get_client_server_configuration, ClientServerConfiguration};
|
||||||
use flowy_sdk::{FlowySDK, FlowySDKConfig};
|
use flowy_sdk::{FlowySDK, FlowySDKConfig};
|
||||||
use flowy_user::entities::UserProfile;
|
use flowy_user::entities::UserProfile;
|
||||||
use lib_infra::uuid_string;
|
use lib_infra::uuid_string;
|
||||||
|
1
shared-lib/Cargo.lock
generated
1
shared-lib/Cargo.lock
generated
@ -1118,7 +1118,6 @@ dependencies = [
|
|||||||
name = "lib-ws"
|
name = "lib-ws"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backend-service",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"env_logger 0.8.4",
|
"env_logger 0.8.4",
|
||||||
|
@ -7,7 +7,6 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
flowy-derive = { path = "../flowy-derive" }
|
flowy-derive = { path = "../flowy-derive" }
|
||||||
backend-service = { path = "../backend-service" }
|
|
||||||
lib-infra = { path = "../lib-infra" }
|
lib-infra = { path = "../lib-infra" }
|
||||||
|
|
||||||
tokio-tungstenite = "0.15"
|
tokio-tungstenite = "0.15"
|
||||||
|
@ -2,6 +2,7 @@ use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
|||||||
use futures_channel::mpsc::TrySendError;
|
use futures_channel::mpsc::TrySendError;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use strum_macros::Display;
|
use strum_macros::Display;
|
||||||
|
use tokio::sync::oneshot::error::RecvError;
|
||||||
use tokio_tungstenite::tungstenite::{http::StatusCode, Message};
|
use tokio_tungstenite::tungstenite::{http::StatusCode, Message};
|
||||||
use url::ParseError;
|
use url::ParseError;
|
||||||
|
|
||||||
@ -83,6 +84,12 @@ impl std::convert::From<futures_channel::mpsc::TrySendError<Message>> for WSErro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::convert::From<RecvError> for WSError {
|
||||||
|
fn from(error: RecvError) -> Self {
|
||||||
|
WSError::internal().context(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl std::convert::From<tokio_tungstenite::tungstenite::Error> for WSError {
|
impl std::convert::From<tokio_tungstenite::tungstenite::Error> for WSError {
|
||||||
fn from(error: tokio_tungstenite::tungstenite::Error) -> Self {
|
fn from(error: tokio_tungstenite::tungstenite::Error) -> Self {
|
||||||
match error {
|
match error {
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
#![cfg_attr(rustfmt, rustfmt::skip)]
|
|
||||||
// Auto-generated, do not edit
|
|
||||||
|
|
||||||
mod errors;
|
|
||||||
pub use errors::*;
|
|
||||||
|
|
||||||
mod msg;
|
|
||||||
pub use msg::*;
|
|
@ -4,7 +4,6 @@ use crate::{
|
|||||||
errors::WSError,
|
errors::WSError,
|
||||||
WSChannel, WebSocketRawMessage,
|
WSChannel, WebSocketRawMessage,
|
||||||
};
|
};
|
||||||
use backend_service::errors::ServerError;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
|
use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||||
@ -73,7 +72,7 @@ impl WSController {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start(&self, addr: String) -> Result<(), ServerError> {
|
pub async fn start(&self, addr: String) -> Result<(), WSError> {
|
||||||
*self.addr.write().await = Some(addr.clone());
|
*self.addr.write().await = Some(addr.clone());
|
||||||
let strategy = FixedInterval::from_millis(5000).take(3);
|
let strategy = FixedInterval::from_millis(5000).take(3);
|
||||||
self.connect(addr, strategy).await
|
self.connect(addr, strategy).await
|
||||||
@ -89,7 +88,7 @@ impl WSController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn connect<T, I>(&self, addr: String, strategy: T) -> Result<(), ServerError>
|
async fn connect<T, I>(&self, addr: String, strategy: T) -> Result<(), WSError>
|
||||||
where
|
where
|
||||||
T: IntoIterator<IntoIter = I, Item = Duration>,
|
T: IntoIterator<IntoIter = I, Item = Duration>,
|
||||||
I: Iterator<Item = Duration> + Send + 'static,
|
I: Iterator<Item = Duration> + Send + 'static,
|
||||||
@ -100,7 +99,7 @@ impl WSController {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let (ret, rx) = oneshot::channel::<Result<(), ServerError>>();
|
let (ret, rx) = oneshot::channel::<Result<(), WSError>>();
|
||||||
*self.addr.write().await = Some(addr.clone());
|
*self.addr.write().await = Some(addr.clone());
|
||||||
let action = WSConnectAction {
|
let action = WSConnectAction {
|
||||||
addr,
|
addr,
|
||||||
@ -133,14 +132,14 @@ impl WSController {
|
|||||||
.write()
|
.write()
|
||||||
.await
|
.await
|
||||||
.update_state(WSConnectState::Disconnected);
|
.update_state(WSConnectState::Disconnected);
|
||||||
let _ = ret.send(Err(ServerError::internal().context(e)));
|
let _ = ret.send(Err(WSError::internal().context(e)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rx.await?
|
rx.await?
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn retry(&self, count: usize) -> Result<(), ServerError> {
|
pub async fn retry(&self, count: usize) -> Result<(), WSError> {
|
||||||
if !self.conn_state_notify.read().await.conn_state.is_disconnected() {
|
if !self.conn_state_notify.read().await.conn_state.is_disconnected() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user