[rust]: extract flowy-document-infra

This commit is contained in:
appflowy 2021-11-13 11:11:24 +08:00
parent 22b93f0343
commit b4237b1986
95 changed files with 344 additions and 566 deletions

View File

@ -0,0 +1,3 @@
// Auto-generated, do not edit
export './revision.pb.dart';
export './doc.pb.dart';

View File

@ -1,11 +0,0 @@
///
// Generated code. Do not modify.
// source: event.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
import 'dart:core' as $core;
export 'event.pbenum.dart';

View File

@ -1,30 +0,0 @@
///
// Generated code. Do not modify.
// source: event.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
// ignore_for_file: UNDEFINED_SHOWN_NAME
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class EditorEvent extends $pb.ProtobufEnum {
static const EditorEvent CreateDoc = EditorEvent._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateDoc');
static const EditorEvent UpdateDoc = EditorEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateDoc');
static const EditorEvent ReadDoc = EditorEvent._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadDoc');
static const EditorEvent DeleteDoc = EditorEvent._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteDoc');
static const $core.List<EditorEvent> values = <EditorEvent> [
CreateDoc,
UpdateDoc,
ReadDoc,
DeleteDoc,
];
static final $core.Map<$core.int, EditorEvent> _byValue = $pb.ProtobufEnum.initByValue(values);
static EditorEvent? valueOf($core.int value) => _byValue[value];
const EditorEvent._($core.int v, $core.String n) : super(v, n);
}

View File

@ -1,23 +0,0 @@
///
// Generated code. Do not modify.
// source: event.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use editorEventDescriptor instead')
const EditorEvent$json = const {
'1': 'EditorEvent',
'2': const [
const {'1': 'CreateDoc', '2': 0},
const {'1': 'UpdateDoc', '2': 1},
const {'1': 'ReadDoc', '2': 2},
const {'1': 'DeleteDoc', '2': 3},
],
};
/// Descriptor for `EditorEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List editorEventDescriptor = $convert.base64Decode('CgtFZGl0b3JFdmVudBINCglDcmVhdGVEb2MQABINCglVcGRhdGVEb2MQARILCgdSZWFkRG9jEAISDQoJRGVsZXRlRG9jEAM=');

View File

@ -1,9 +0,0 @@
///
// Generated code. Do not modify.
// source: event.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
export 'event.pb.dart';

View File

@ -2,6 +2,3 @@
export './ws.pb.dart';
export './observable.pb.dart';
export './errors.pb.dart';
export './revision.pb.dart';
export './event.pb.dart';
export './doc.pb.dart';

View File

@ -62,6 +62,7 @@ async-stream = "0.3.2"
flowy-user-infra = { path = "../rust-lib/flowy-user-infra" }
flowy-workspace-infra = { path = "../rust-lib/flowy-workspace-infra" }
flowy-document-infra = { path = "../rust-lib/flowy-document-infra" }
flowy-document = { path = "../rust-lib/flowy-document" }
flowy-ws = { path = "../rust-lib/flowy-ws" }
flowy-ot = { path = "../rust-lib/flowy-ot" }

View File

@ -1,4 +1,4 @@
use flowy_document::protobuf::Doc;
use flowy_document_infra::protobuf::Doc;
pub(crate) const DOC_TABLE: &'static str = "doc_table";

View File

@ -3,7 +3,7 @@ use crate::{
sqlx_ext::{map_sqlx_error, DBTransaction, SqlBuilder},
};
use anyhow::Context;
use flowy_document::protobuf::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
use flowy_document_infra::protobuf::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
use flowy_net::errors::ServerError;
use sqlx::{postgres::PgArguments, PgPool, Postgres};
use uuid::Uuid;

View File

@ -8,7 +8,7 @@ use crate::service::{
};
use actix_web::web::Data;
use dashmap::DashMap;
use flowy_document::protobuf::DocIdentifier;
use flowy_document_infra::protobuf::DocIdentifier;
use flowy_net::errors::{internal_error, ServerError};
use sqlx::PgPool;
use std::sync::Arc;

View File

@ -4,7 +4,7 @@ use crate::service::{
};
use actix_web::web::Data;
use async_stream::stream;
use flowy_document::protobuf::{Doc, Revision};
use flowy_document_infra::protobuf::{Doc, Revision};
use flowy_net::errors::{internal_error, Result as DocResult, ServerError};
use futures::stream::StreamExt;
use sqlx::PgPool;

View File

@ -10,9 +10,9 @@ use bytes::Bytes;
use dashmap::DashMap;
use flowy_document::{
entities::ws::{WsDataType, WsDocumentData},
protobuf::{Doc, RevId, RevType, Revision, RevisionRange, UpdateDocParams},
services::doc::Document,
};
use flowy_document_infra::protobuf::{Doc, RevId, RevType, Revision, RevisionRange, UpdateDocParams};
use flowy_net::errors::{internal_error, ServerError};
use flowy_ot::core::{Delta, OperationTransformable};
use flowy_ws::WsMessage;

View File

@ -3,7 +3,7 @@ use crate::service::{
ws::{entities::Socket, WsUser},
};
use actix_web::web::Data;
use flowy_document::protobuf::{Doc, Revision};
use flowy_document_infra::protobuf::{Doc, Revision};
use flowy_net::errors::{internal_error, Result as DocResult, ServerError};
use sqlx::PgPool;
use std::sync::Arc;

View File

@ -7,7 +7,7 @@ use actix_web::{
HttpResponse,
};
use anyhow::Context;
use flowy_document::protobuf::{CreateDocParams, DocIdentifier, UpdateDocParams};
use flowy_document_infra::protobuf::{CreateDocParams, DocIdentifier, UpdateDocParams};
use flowy_net::{errors::ServerError, response::FlowyResponse};
use sqlx::PgPool;

View File

@ -6,7 +6,8 @@ use crate::service::{
use actix_rt::task::spawn_blocking;
use actix_web::web::Data;
use async_stream::stream;
use flowy_document::protobuf::{NewDocUser, Revision, WsDataType, WsDocumentData};
use flowy_document::protobuf::{WsDataType, WsDocumentData};
use flowy_document_infra::protobuf::{NewDocUser, Revision};
use flowy_net::errors::{internal_error, Result as DocResult, ServerError};
use futures::stream::StreamExt;
use sqlx::PgPool;

View File

@ -8,7 +8,7 @@ use crate::{
use crate::service::view::{create_view_with_args, sql_builder::NewViewSqlBuilder};
use chrono::Utc;
use flowy_document::services::doc::doc_initial_string;
use flowy_document_infra::document_default::doc_initial_string;
use flowy_net::errors::ServerError;
use flowy_workspace_infra::protobuf::Workspace;
use std::convert::TryInto;

View File

@ -9,7 +9,7 @@ use crate::{
sqlx_ext::{map_sqlx_error, DBTransaction, SqlBuilder},
};
use chrono::Utc;
use flowy_document::protobuf::CreateDocParams;
use flowy_document_infra::protobuf::CreateDocParams;
use flowy_net::errors::{invalid_params, ServerError};
use flowy_workspace_infra::{
parser::{

View File

@ -1,5 +1,5 @@
use crate::helper::ViewTest;
use flowy_document::entities::doc::DocIdentifier;
use flowy_document_infra::entities::doc::DocIdentifier;
use flowy_workspace_infra::entities::view::ViewIdentifiers;
#[actix_rt::test]

View File

@ -1,20 +1,16 @@
use std::sync::Arc;
use actix_web::web::Data;
use futures_util::{stream, stream::StreamExt};
use sqlx::PgPool;
use tokio::time::{sleep, Duration};
use backend::service::doc::{crud::update_doc, doc::DocManager};
use flowy_document::{entities::doc::DocIdentifier, services::doc::edit::ClientEditDoc as ClientEditDocContext};
use flowy_document::services::doc::ClientEditDoc as ClientEditDocContext;
use flowy_net::config::ServerConfig;
use flowy_test::{workspace::ViewTest, FlowyTest};
use flowy_user::services::user::UserSession;
use futures_util::{stream, stream::StreamExt};
use sqlx::PgPool;
use std::sync::Arc;
use tokio::time::{sleep, Duration};
// use crate::helper::*;
use crate::helper::{spawn_server, TestServer};
use flowy_document::protobuf::UpdateDocParams;
use flowy_document_infra::{entities::doc::DocIdentifier, protobuf::UpdateDocParams};
use flowy_ot::core::{Attribute, Delta, Interval};
use parking_lot::RwLock;

View File

@ -1,15 +1,11 @@
use backend::{
application::{get_connection_pool, Application},
application::{get_connection_pool, init_app_context, Application},
config::{get_configuration, DatabaseSettings},
context::AppContext,
};
use backend::application::init_app_context;
use flowy_backend_api::{user_request::*, workspace_request::*};
use flowy_document::{
entities::doc::{Doc, DocIdentifier},
prelude::*,
};
use flowy_document::services::server::read_doc_request;
use flowy_document_infra::entities::doc::{Doc, DocIdentifier};
use flowy_net::errors::ServerError;
use flowy_user_infra::entities::*;
use flowy_workspace_infra::entities::prelude::*;

View File

@ -16,6 +16,7 @@ members = [
"flowy-workspace-infra",
"flowy-dart-notify",
"flowy-document",
"flowy-document-infra",
"flowy-ot",
"flowy-net",
"flowy-ws",

View File

@ -48,6 +48,15 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "RepeatedView"
| "ExportRequest"
| "ExportData"
| "CreateDocParams"
| "Doc"
| "UpdateDocParams"
| "DocDelta"
| "NewDocUser"
| "DocIdentifier"
| "RevId"
| "Revision"
| "RevisionRange"
| "KeyValue"
| "WorkspaceError"
| "WsError"
@ -62,15 +71,6 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "UserProfile"
| "UpdateUserRequest"
| "UpdateUserParams"
| "CreateDocParams"
| "Doc"
| "UpdateDocParams"
| "DocDelta"
| "NewDocUser"
| "DocIdentifier"
| "RevId"
| "Revision"
| "RevisionRange"
| "WsDocumentData"
| "DocError"
| "FFIRequest"
@ -82,10 +82,10 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "ViewType"
| "ExportType"
| "ErrorCode"
| "RevType"
| "WorkspaceEvent"
| "WorkspaceNotification"
| "WsModule"
| "RevType"
| "WsDataType"
| "DocObservable"
| "FFIStatusCode"

View File

@ -0,0 +1,14 @@
[package]
name = "flowy-document-infra"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
flowy-ot = { path = "../flowy-ot" }
flowy-derive = { path = "../flowy-derive" }
protobuf = {version = "2.18.0"}
bytes = "1.0"
log = "0.4.14"
md5 = "0.7.0"

View File

@ -0,0 +1,3 @@
proto_crates = ["src/entities"]
event_files = []

View File

@ -0,0 +1,23 @@
use flowy_ot::core::{Delta, DeltaBuilder};
#[allow(dead_code)]
#[inline]
pub fn doc_initial_delta() -> Delta { DeltaBuilder::new().insert("\n").build() }
#[allow(dead_code)]
#[inline]
pub fn doc_initial_string() -> String { doc_initial_delta().to_json() }
#[allow(dead_code)]
#[inline]
pub fn doc_initial_bytes() -> Vec<u8> { doc_initial_string().into_bytes() }
#[cfg(test)]
mod tests {
use flowy_ot::core::Delta;
#[test]
fn load_read_me() {
let json = include_str!("READ_ME.json");
let delta = Delta::from_json(json).unwrap();
assert_eq!(delta.to_json(), json);
}
}

View File

@ -1,6 +1,5 @@
use crate::errors::DocResult;
use flowy_derive::ProtoBuf;
use flowy_ot::core::Delta;
use flowy_ot::{core::Delta, errors::OTError};
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct CreateDocParams {
@ -36,7 +35,7 @@ pub struct Doc {
}
impl Doc {
pub fn delta(&self) -> DocResult<Delta> {
pub fn delta(&self) -> Result<Delta, OTError> {
let delta = Delta::from_bytes(&self.data)?;
Ok(delta)
}

View File

@ -1,6 +1,4 @@
use crate::services::util::md5;
use crate::entities::doc::Doc;
use crate::{entities::doc::Doc, util::md5};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_ot::core::Delta;
use std::{fmt::Formatter, ops::RangeInclusive};

View File

@ -0,0 +1 @@
pub mod doc;

View File

@ -0,0 +1,4 @@
pub mod document_default;
pub mod entities;
pub mod protobuf;
pub mod util;

View File

@ -0,0 +1,4 @@
mod model;
pub use model::*;

View File

@ -1340,56 +1340,56 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x17\n\x07user_id\x18\x01\x20\x01(\tR\x06userId\x12\x15\n\x06rev_id\x18\
\x02\x20\x01(\x03R\x05revId\x12\x15\n\x06doc_id\x18\x03\x20\x01(\tR\x05d\
ocId\"&\n\rDocIdentifier\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docI\
dJ\xdb\x07\n\x06\x12\x04\0\0\x1c\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\
\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x12\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\r\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x10\x11\n\x0b\n\x04\x04\0\x02\x01\
\x12\x03\x04\x04\x14\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\x04\n\n\
\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x0f\n\x0c\n\x05\x04\0\x02\
\x01\x03\x12\x03\x04\x12\x13\n\n\n\x02\x04\x01\x12\x04\x06\0\x0b\x01\n\n\
\n\x03\x04\x01\x01\x12\x03\x06\x08\x0b\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
\x07\x04\x12\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x07\x04\n\n\x0c\n\x05\
\x04\x01\x02\0\x01\x12\x03\x07\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
\x03\x07\x10\x11\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x08\x04\x14\n\x0c\n\
\x05\x04\x01\x02\x01\x05\x12\x03\x08\x04\n\n\x0c\n\x05\x04\x01\x02\x01\
\x01\x12\x03\x08\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x08\x12\
\x13\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\t\x04\x15\n\x0c\n\x05\x04\x01\
\x02\x02\x05\x12\x03\t\x04\t\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\t\n\
\x10\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\t\x13\x14\n\x0b\n\x04\x04\
\x01\x02\x03\x12\x03\n\x04\x1a\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\n\
\x04\t\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\n\n\x15\n\x0c\n\x05\x04\
\x01\x02\x03\x03\x12\x03\n\x18\x19\n\n\n\x02\x04\x02\x12\x04\x0c\0\x10\
\x01\n\n\n\x03\x04\x02\x01\x12\x03\x0c\x08\x17\n\x0b\n\x04\x04\x02\x02\0\
\x12\x03\r\x04\x16\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\r\x04\n\n\x0c\n\
\x05\x04\x02\x02\0\x01\x12\x03\r\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\x03\
\x12\x03\r\x14\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0e\x04\x14\n\x0c\
\n\x05\x04\x02\x02\x01\x05\x12\x03\x0e\x04\n\n\x0c\n\x05\x04\x02\x02\x01\
\x01\x12\x03\x0e\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x0e\x12\
\x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x0f\x04\x15\n\x0c\n\x05\x04\x02\
\x02\x02\x05\x12\x03\x0f\x04\t\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\
\x0f\n\x10\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x0f\x13\x14\n\n\n\x02\
\x04\x03\x12\x04\x11\0\x14\x01\n\n\n\x03\x04\x03\x01\x12\x03\x11\x08\x10\
\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x12\x04\x16\n\x0c\n\x05\x04\x03\x02\0\
\x05\x12\x03\x12\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x12\x0b\x11\
\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x12\x14\x15\n\x0b\n\x04\x04\x03\
\x02\x01\x12\x03\x13\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x13\
\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x13\x0b\x0f\n\x0c\n\x05\
\x04\x03\x02\x01\x03\x12\x03\x13\x12\x13\n\n\n\x02\x04\x04\x12\x04\x15\0\
\x19\x01\n\n\n\x03\x04\x04\x01\x12\x03\x15\x08\x12\n\x0b\n\x04\x04\x04\
\x02\0\x12\x03\x16\x04\x17\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x16\x04\
\n\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03\x16\x0b\x12\n\x0c\n\x05\x04\x04\
\x02\0\x03\x12\x03\x16\x15\x16\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\x17\
\x04\x15\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\x17\x04\t\n\x0c\n\x05\
\x04\x04\x02\x01\x01\x12\x03\x17\n\x10\n\x0c\n\x05\x04\x04\x02\x01\x03\
\x12\x03\x17\x13\x14\n\x0b\n\x04\x04\x04\x02\x02\x12\x03\x18\x04\x16\n\
\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03\x18\x04\n\n\x0c\n\x05\x04\x04\x02\
\x02\x01\x12\x03\x18\x0b\x11\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03\x18\
\x14\x15\n\n\n\x02\x04\x05\x12\x04\x1a\0\x1c\x01\n\n\n\x03\x04\x05\x01\
\x12\x03\x1a\x08\x15\n\x0b\n\x04\x04\x05\x02\0\x12\x03\x1b\x04\x16\n\x0c\
\n\x05\x04\x05\x02\0\x05\x12\x03\x1b\x04\n\n\x0c\n\x05\x04\x05\x02\0\x01\
\x12\x03\x1b\x0b\x11\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03\x1b\x14\x15b\
\x06proto3\
dJ\xdb\x07\n\x06\x12\x04\0\0\x1b\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
\n\x02\x04\0\x12\x04\x01\0\x04\x01\n\n\n\x03\x04\0\x01\x12\x03\x01\x08\
\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x12\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x02\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x02\x0b\r\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02\x10\x11\n\x0b\n\x04\x04\0\x02\x01\
\x12\x03\x03\x04\x14\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x03\x04\n\n\
\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x03\x0b\x0f\n\x0c\n\x05\x04\0\x02\
\x01\x03\x12\x03\x03\x12\x13\n\n\n\x02\x04\x01\x12\x04\x05\0\n\x01\n\n\n\
\x03\x04\x01\x01\x12\x03\x05\x08\x0b\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
\x06\x04\x12\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x06\x04\n\n\x0c\n\x05\
\x04\x01\x02\0\x01\x12\x03\x06\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
\x03\x06\x10\x11\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x07\x04\x14\n\x0c\n\
\x05\x04\x01\x02\x01\x05\x12\x03\x07\x04\n\n\x0c\n\x05\x04\x01\x02\x01\
\x01\x12\x03\x07\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x07\x12\
\x13\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x08\x04\x15\n\x0c\n\x05\x04\x01\
\x02\x02\x05\x12\x03\x08\x04\t\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\
\x08\n\x10\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x08\x13\x14\n\x0b\n\
\x04\x04\x01\x02\x03\x12\x03\t\x04\x1a\n\x0c\n\x05\x04\x01\x02\x03\x05\
\x12\x03\t\x04\t\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\t\n\x15\n\x0c\n\
\x05\x04\x01\x02\x03\x03\x12\x03\t\x18\x19\n\n\n\x02\x04\x02\x12\x04\x0b\
\0\x0f\x01\n\n\n\x03\x04\x02\x01\x12\x03\x0b\x08\x17\n\x0b\n\x04\x04\x02\
\x02\0\x12\x03\x0c\x04\x16\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0c\x04\
\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x0c\x0b\x11\n\x0c\n\x05\x04\x02\
\x02\0\x03\x12\x03\x0c\x14\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\r\x04\
\x14\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x02\
\x02\x01\x01\x12\x03\r\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\r\
\x12\x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x0e\x04\x15\n\x0c\n\x05\x04\
\x02\x02\x02\x05\x12\x03\x0e\x04\t\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\
\x03\x0e\n\x10\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x0e\x13\x14\n\n\n\
\x02\x04\x03\x12\x04\x10\0\x13\x01\n\n\n\x03\x04\x03\x01\x12\x03\x10\x08\
\x10\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x11\x04\x16\n\x0c\n\x05\x04\x03\
\x02\0\x05\x12\x03\x11\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x11\
\x0b\x11\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x11\x14\x15\n\x0b\n\x04\
\x04\x03\x02\x01\x12\x03\x12\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\
\x03\x12\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x12\x0b\x0f\n\x0c\
\n\x05\x04\x03\x02\x01\x03\x12\x03\x12\x12\x13\n\n\n\x02\x04\x04\x12\x04\
\x14\0\x18\x01\n\n\n\x03\x04\x04\x01\x12\x03\x14\x08\x12\n\x0b\n\x04\x04\
\x04\x02\0\x12\x03\x15\x04\x17\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x15\
\x04\n\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03\x15\x0b\x12\n\x0c\n\x05\x04\
\x04\x02\0\x03\x12\x03\x15\x15\x16\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\
\x16\x04\x15\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\x16\x04\t\n\x0c\n\
\x05\x04\x04\x02\x01\x01\x12\x03\x16\n\x10\n\x0c\n\x05\x04\x04\x02\x01\
\x03\x12\x03\x16\x13\x14\n\x0b\n\x04\x04\x04\x02\x02\x12\x03\x17\x04\x16\
\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03\x17\x04\n\n\x0c\n\x05\x04\x04\
\x02\x02\x01\x12\x03\x17\x0b\x11\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03\
\x17\x14\x15\n\n\n\x02\x04\x05\x12\x04\x19\0\x1b\x01\n\n\n\x03\x04\x05\
\x01\x12\x03\x19\x08\x15\n\x0b\n\x04\x04\x05\x02\0\x12\x03\x1a\x04\x16\n\
\x0c\n\x05\x04\x05\x02\0\x05\x12\x03\x1a\x04\n\n\x0c\n\x05\x04\x05\x02\0\
\x01\x12\x03\x1a\x0b\x11\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03\x1a\x14\
\x15b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -0,0 +1,7 @@
// Auto-generated, do not edit
mod revision;
pub use revision::*;
mod doc;
pub use doc::*;

View File

@ -808,44 +808,44 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\n\rRevisionRange\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12\
\x14\n\x05start\x18\x02\x20\x01(\x03R\x05start\x12\x10\n\x03end\x18\x03\
\x20\x01(\x03R\x03end*\x20\n\x07RevType\x12\t\n\x05Local\x10\0\x12\n\n\
\x06Remote\x10\x01J\xea\x05\n\x06\x12\x04\0\0\x15\x01\n\x08\n\x01\x0c\
\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\n\x03\x04\0\
\x01\x12\x03\x02\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x14\n\x0c\
\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\t\n\x0c\n\x05\x04\0\x02\0\x01\x12\
\x03\x03\n\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x12\x13\n\n\n\x02\
\x04\x01\x12\x04\x05\0\x0c\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\x10\
\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x06\x04\x1a\n\x0c\n\x05\x04\x01\x02\0\
\x05\x12\x03\x06\x04\t\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06\n\x15\n\
\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x06\x18\x19\n\x0b\n\x04\x04\x01\x02\
\x01\x12\x03\x07\x04\x15\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x07\x04\
\t\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x07\n\x10\n\x0c\n\x05\x04\x01\
\x02\x01\x03\x12\x03\x07\x13\x14\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x08\
\x04\x19\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x08\x04\t\n\x0c\n\x05\
\x04\x01\x02\x02\x01\x12\x03\x08\n\x14\n\x0c\n\x05\x04\x01\x02\x02\x03\
\x12\x03\x08\x17\x18\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\t\x04\x13\n\x0c\
\n\x05\x04\x01\x02\x03\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x03\
\x01\x12\x03\t\x0b\x0e\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\t\x11\x12\
\n\x0b\n\x04\x04\x01\x02\x04\x12\x03\n\x04\x16\n\x0c\n\x05\x04\x01\x02\
\x04\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03\n\x0b\
\x11\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03\n\x14\x15\n\x0b\n\x04\x04\
\x01\x02\x05\x12\x03\x0b\x04\x13\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\x03\
\x0b\x04\x0b\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03\x0b\x0c\x0e\n\x0c\n\
\x05\x04\x01\x02\x05\x03\x12\x03\x0b\x11\x12\n\n\n\x02\x04\x02\x12\x04\r\
\0\x11\x01\n\n\n\x03\x04\x02\x01\x12\x03\r\x08\x15\n\x0b\n\x04\x04\x02\
\x02\0\x12\x03\x0e\x04\x16\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0e\x04\
\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x0e\x0b\x11\n\x0c\n\x05\x04\x02\
\x02\0\x03\x12\x03\x0e\x14\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0f\
\x04\x14\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0f\x04\t\n\x0c\n\x05\
\x04\x02\x02\x01\x01\x12\x03\x0f\n\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\
\x12\x03\x0f\x12\x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x10\x04\x12\n\
\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x10\x04\t\n\x0c\n\x05\x04\x02\x02\
\x02\x01\x12\x03\x10\n\r\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x10\x10\
\x11\n\n\n\x02\x05\0\x12\x04\x12\0\x15\x01\n\n\n\x03\x05\0\x01\x12\x03\
\x12\x05\x0c\n\x0b\n\x04\x05\0\x02\0\x12\x03\x13\x04\x0e\n\x0c\n\x05\x05\
\0\x02\0\x01\x12\x03\x13\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x13\
\x0c\r\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x14\x04\x0f\n\x0c\n\x05\x05\0\
\x02\x01\x01\x12\x03\x14\x04\n\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x14\
\r\x0eb\x06proto3\
\x06Remote\x10\x01J\xea\x05\n\x06\x12\x04\0\0\x14\x01\n\x08\n\x01\x0c\
\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x01\0\x03\x01\n\n\n\x03\x04\0\
\x01\x12\x03\x01\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x14\n\x0c\
\n\x05\x04\0\x02\0\x05\x12\x03\x02\x04\t\n\x0c\n\x05\x04\0\x02\0\x01\x12\
\x03\x02\n\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02\x12\x13\n\n\n\x02\
\x04\x01\x12\x04\x04\0\x0b\x01\n\n\n\x03\x04\x01\x01\x12\x03\x04\x08\x10\
\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x05\x04\x1a\n\x0c\n\x05\x04\x01\x02\0\
\x05\x12\x03\x05\x04\t\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x05\n\x15\n\
\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x05\x18\x19\n\x0b\n\x04\x04\x01\x02\
\x01\x12\x03\x06\x04\x15\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x06\x04\
\t\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x06\n\x10\n\x0c\n\x05\x04\x01\
\x02\x01\x03\x12\x03\x06\x13\x14\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x07\
\x04\x19\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x07\x04\t\n\x0c\n\x05\
\x04\x01\x02\x02\x01\x12\x03\x07\n\x14\n\x0c\n\x05\x04\x01\x02\x02\x03\
\x12\x03\x07\x17\x18\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x08\x04\x13\n\
\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\x08\x04\n\n\x0c\n\x05\x04\x01\x02\
\x03\x01\x12\x03\x08\x0b\x0e\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x08\
\x11\x12\n\x0b\n\x04\x04\x01\x02\x04\x12\x03\t\x04\x16\n\x0c\n\x05\x04\
\x01\x02\x04\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03\
\t\x0b\x11\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03\t\x14\x15\n\x0b\n\x04\
\x04\x01\x02\x05\x12\x03\n\x04\x13\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\
\x03\n\x04\x0b\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03\n\x0c\x0e\n\x0c\n\
\x05\x04\x01\x02\x05\x03\x12\x03\n\x11\x12\n\n\n\x02\x04\x02\x12\x04\x0c\
\0\x10\x01\n\n\n\x03\x04\x02\x01\x12\x03\x0c\x08\x15\n\x0b\n\x04\x04\x02\
\x02\0\x12\x03\r\x04\x16\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\r\x04\n\n\
\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\r\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\
\x03\x12\x03\r\x14\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0e\x04\x14\n\
\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0e\x04\t\n\x0c\n\x05\x04\x02\x02\
\x01\x01\x12\x03\x0e\n\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x0e\
\x12\x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x0f\x04\x12\n\x0c\n\x05\x04\
\x02\x02\x02\x05\x12\x03\x0f\x04\t\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\
\x03\x0f\n\r\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x0f\x10\x11\n\n\n\
\x02\x05\0\x12\x04\x11\0\x14\x01\n\n\n\x03\x05\0\x01\x12\x03\x11\x05\x0c\
\n\x0b\n\x04\x05\0\x02\0\x12\x03\x12\x04\x0e\n\x0c\n\x05\x05\0\x02\0\x01\
\x12\x03\x12\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x12\x0c\r\n\x0b\n\
\x04\x05\0\x02\x01\x12\x03\x13\x04\x0f\n\x0c\n\x05\x05\0\x02\x01\x01\x12\
\x03\x13\x04\n\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x13\r\x0eb\x06proto\
3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -1,5 +1,4 @@
syntax = "proto3";
message CreateDocParams {
string id = 1;
string data = 2;

View File

@ -1,5 +1,4 @@
syntax = "proto3";
message RevId {
int64 value = 1;
}

View File

@ -25,7 +25,7 @@ pub fn md5<T: AsRef<[u8]>>(data: T) -> String {
}
#[derive(Debug)]
pub(crate) struct RevIdCounter(pub AtomicI64);
pub struct RevIdCounter(pub AtomicI64);
impl RevIdCounter {
pub fn new(n: i64) -> Self { Self(AtomicI64::new(n)) }

View File

@ -7,6 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
flowy-document-infra = { path = "../flowy-document-infra" }
derive_more = {version = "0.99", features = ["display"]}
flowy-dispatch = { path = "../flowy-dispatch" }
flowy-derive = { path = "../flowy-derive" }
@ -37,7 +38,6 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}
chrono = "0.4.19"
futures-core = { version = "0.3", default-features = false }
md5 = "0.7.0"
byteorder = {version = "1.3.4"}
async-stream = "0.3.2"
futures = "0.3.15"

View File

@ -1,2 +1 @@
pub mod doc;
pub mod ws;

View File

@ -1,9 +1,7 @@
use crate::{
entities::doc::{NewDocUser, Revision},
errors::DocError,
};
use crate::errors::DocError;
use bytes::Bytes;
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_document_infra::entities::doc::{NewDocUser, Revision};
use flowy_ws::{WsMessage, WsModule};
use std::convert::{TryFrom, TryInto};

View File

@ -10,10 +10,3 @@ mod sql_tables;
#[macro_use]
extern crate flowy_database;
pub mod prelude {
pub use crate::{
module::*,
services::{server::*, ws::*},
};
}

View File

@ -1,13 +1,13 @@
use crate::{
entities::doc::{DocDelta, DocIdentifier},
errors::DocError,
services::{
doc::{doc_controller::DocController, edit::ClientEditDoc},
doc::{doc_controller::DocController, ClientEditDoc},
server::construct_doc_server,
ws::WsDocumentManager,
},
};
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{DocDelta, DocIdentifier};
use flowy_net::config::ServerConfig;
use std::sync::Arc;

View File

@ -1,108 +0,0 @@
// This file is generated by rust-protobuf 2.22.1. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `event.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum EditorEvent {
CreateDoc = 0,
UpdateDoc = 1,
ReadDoc = 2,
DeleteDoc = 3,
}
impl ::protobuf::ProtobufEnum for EditorEvent {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<EditorEvent> {
match value {
0 => ::std::option::Option::Some(EditorEvent::CreateDoc),
1 => ::std::option::Option::Some(EditorEvent::UpdateDoc),
2 => ::std::option::Option::Some(EditorEvent::ReadDoc),
3 => ::std::option::Option::Some(EditorEvent::DeleteDoc),
_ => ::std::option::Option::None
}
}
fn values() -> &'static [Self] {
static values: &'static [EditorEvent] = &[
EditorEvent::CreateDoc,
EditorEvent::UpdateDoc,
EditorEvent::ReadDoc,
EditorEvent::DeleteDoc,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<EditorEvent>("EditorEvent", file_descriptor_proto())
})
}
}
impl ::std::marker::Copy for EditorEvent {
}
impl ::std::default::Default for EditorEvent {
fn default() -> Self {
EditorEvent::CreateDoc
}
}
impl ::protobuf::reflect::ProtobufValue for EditorEvent {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0bevent.proto*G\n\x0bEditorEvent\x12\r\n\tCreateDoc\x10\0\x12\r\n\tU\
pdateDoc\x10\x01\x12\x0b\n\x07ReadDoc\x10\x02\x12\r\n\tDeleteDoc\x10\x03\
J\xce\x01\n\x06\x12\x04\0\0\x07\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
\n\x02\x05\0\x12\x04\x02\0\x07\x01\n\n\n\x03\x05\0\x01\x12\x03\x02\x05\
\x10\n\x0b\n\x04\x05\0\x02\0\x12\x03\x03\x04\x12\n\x0c\n\x05\x05\0\x02\0\
\x01\x12\x03\x03\x04\r\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x03\x10\x11\n\
\x0b\n\x04\x05\0\x02\x01\x12\x03\x04\x04\x12\n\x0c\n\x05\x05\0\x02\x01\
\x01\x12\x03\x04\x04\r\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x04\x10\x11\
\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x05\x04\x10\n\x0c\n\x05\x05\0\x02\x02\
\x01\x12\x03\x05\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\x05\x0e\
\x0f\n\x0b\n\x04\x05\0\x02\x03\x12\x03\x06\x04\x12\n\x0c\n\x05\x05\0\x02\
\x03\x01\x12\x03\x06\x04\r\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x06\x10\
\x11b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
}
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
file_descriptor_proto_lazy.get(|| {
parse_descriptor_proto()
})
}

View File

@ -8,12 +8,3 @@ pub use observable::*;
mod errors;
pub use errors::*;
mod revision;
pub use revision::*;
mod event;
pub use event::*;
mod doc;
pub use doc::*;

View File

@ -320,28 +320,28 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x02ty\x12\x12\n\x04data\x18\x03\x20\x01(\x0cR\x04data*O\n\nWsDataType\
\x12\t\n\x05Acked\x10\0\x12\x0b\n\x07PushRev\x10\x01\x12\x0b\n\x07PullRe\
v\x10\x02\x12\x0c\n\x08Conflict\x10\x03\x12\x0e\n\nNewDocUser\x10\x04J\
\xb4\x03\n\x06\x12\x04\0\0\r\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\
\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x16\
\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\
\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x11\n\x0c\
\n\x05\x04\0\x02\0\x03\x12\x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\
\x03\x04\x04\x16\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x04\x04\x0e\n\x0c\
\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0f\x11\n\x0c\n\x05\x04\0\x02\x01\
\x03\x12\x03\x04\x14\x15\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x05\x04\x13\n\
\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\t\n\x0c\n\x05\x04\0\x02\x02\
\x01\x12\x03\x05\n\x0e\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x05\x11\x12\
\n\n\n\x02\x05\0\x12\x04\x07\0\r\x01\n\n\n\x03\x05\0\x01\x12\x03\x07\x05\
\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x08\x04\x0e\n\x0c\n\x05\x05\0\x02\0\
\x01\x12\x03\x08\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x08\x0c\r\n\
\x0b\n\x04\x05\0\x02\x01\x12\x03\t\x04\x10\n\x0c\n\x05\x05\0\x02\x01\x01\
\x12\x03\t\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\t\x0e\x0f\n\x0b\
\n\x04\x05\0\x02\x02\x12\x03\n\x04\x10\n\x0c\n\x05\x05\0\x02\x02\x01\x12\
\x03\n\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\n\x0e\x0f\n\x0b\n\
\x04\x05\0\x02\x03\x12\x03\x0b\x04\x11\n\x0c\n\x05\x05\0\x02\x03\x01\x12\
\x03\x0b\x04\x0c\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x0b\x0f\x10\n\x0b\
\n\x04\x05\0\x02\x04\x12\x03\x0c\x04\x13\n\x0c\n\x05\x05\0\x02\x04\x01\
\x12\x03\x0c\x04\x0e\n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\x0c\x11\x12b\
\x06proto3\
\xb4\x03\n\x06\x12\x04\0\0\x0c\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\
\x02\x04\0\x12\x04\x01\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\x01\x08\x16\
\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\
\x12\x03\x02\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x02\x0b\x11\n\x0c\
\n\x05\x04\0\x02\0\x03\x12\x03\x02\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\
\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x03\x04\x0e\n\x0c\
\n\x05\x04\0\x02\x01\x01\x12\x03\x03\x0f\x11\n\x0c\n\x05\x04\0\x02\x01\
\x03\x12\x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x04\x04\x13\n\
\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x04\x04\t\n\x0c\n\x05\x04\0\x02\x02\
\x01\x12\x03\x04\n\x0e\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x04\x11\x12\
\n\n\n\x02\x05\0\x12\x04\x06\0\x0c\x01\n\n\n\x03\x05\0\x01\x12\x03\x06\
\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x07\x04\x0e\n\x0c\n\x05\x05\0\
\x02\0\x01\x12\x03\x07\x04\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x07\x0c\
\r\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x08\x04\x10\n\x0c\n\x05\x05\0\x02\
\x01\x01\x12\x03\x08\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x08\
\x0e\x0f\n\x0b\n\x04\x05\0\x02\x02\x12\x03\t\x04\x10\n\x0c\n\x05\x05\0\
\x02\x02\x01\x12\x03\t\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\t\
\x0e\x0f\n\x0b\n\x04\x05\0\x02\x03\x12\x03\n\x04\x11\n\x0c\n\x05\x05\0\
\x02\x03\x01\x12\x03\n\x04\x0c\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\n\
\x0f\x10\n\x0b\n\x04\x05\0\x02\x04\x12\x03\x0b\x04\x13\n\x0c\n\x05\x05\0\
\x02\x04\x01\x12\x03\x0b\x04\x0e\n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\
\x0b\x11\x12b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -1,8 +0,0 @@
syntax = "proto3";
enum EditorEvent {
CreateDoc = 0;
UpdateDoc = 1;
ReadDoc = 2;
DeleteDoc = 3;
}

View File

@ -1,5 +1,4 @@
syntax = "proto3";
message WsDocumentData {
string doc_id = 1;
WsDataType ty = 2;

View File

@ -4,7 +4,7 @@ use dashmap::DashMap;
use crate::{
errors::DocError,
services::doc::edit::{ClientEditDoc, DocId},
services::doc::{ClientEditDoc, DocId},
};
pub(crate) struct DocCache {

View File

@ -1,5 +1,4 @@
use crate::{
entities::doc::{Doc, DocDelta, DocIdentifier},
errors::{DocError, DocResult},
module::DocumentUser,
services::{
@ -14,9 +13,9 @@ use crate::{
};
use bytes::Bytes;
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{Doc, DocDelta, DocIdentifier};
use flowy_infra::future::{wrap_future, FnFuture, ResultFuture};
use std::sync::Arc;
use tokio::time::{interval, Duration};
pub(crate) struct DocController {

View File

@ -2,7 +2,7 @@ use crate::{
errors::DocError,
services::doc::{view::View, History, UndoResult, RECORD_THRESHOLD},
};
use flowy_document_infra::document_default::doc_initial_delta;
use flowy_ot::core::*;
use tokio::sync::mpsc;
@ -15,16 +15,6 @@ impl CustomDocument for PlainDoc {
fn init_delta() -> Delta { Delta::new() }
}
#[allow(dead_code)]
#[inline]
pub fn doc_initial_delta() -> Delta { DeltaBuilder::new().insert("\n").build() }
#[allow(dead_code)]
#[inline]
pub fn doc_initial_string() -> String { doc_initial_delta().to_json() }
#[allow(dead_code)]
#[inline]
pub fn doc_initial_bytes() -> Vec<u8> { doc_initial_string().into_bytes() }
pub struct FlowyDoc();
impl CustomDocument for FlowyDoc {
fn init_delta() -> Delta { doc_initial_delta() }
@ -218,15 +208,3 @@ pub fn trim(delta: &mut Delta) {
}
}
}
#[cfg(test)]
mod tests {
use flowy_ot::core::Delta;
#[test]
fn load_read_me() {
let json = include_str!("../../../READ_ME.json");
let delta = Delta::from_json(json).unwrap();
assert_eq!(delta.to_json(), json);
}
}

View File

@ -1,16 +1,14 @@
use crate::{
entities::doc::{RevId, Revision},
errors::DocResult,
services::doc::{
edit::message::{DocumentMsg, TransformDeltas},
Document,
},
services::doc::{Document, UndoResult},
};
use async_stream::stream;
use flowy_ot::core::{Delta, OperationTransformable};
use bytes::Bytes;
use flowy_document_infra::entities::doc::{RevId, Revision};
use flowy_ot::core::{Attribute, Delta, Interval, OperationTransformable};
use futures::stream::StreamExt;
use std::{convert::TryFrom, sync::Arc};
use tokio::sync::{mpsc, RwLock};
use tokio::sync::{mpsc, oneshot, RwLock};
pub struct DocumentActor {
doc_id: String,
@ -139,3 +137,56 @@ impl DocumentActor {
// });
// Ok(())
// }
pub type Ret<T> = oneshot::Sender<DocResult<T>>;
pub enum DocumentMsg {
Delta {
delta: Delta,
ret: Ret<()>,
},
RemoteRevision {
bytes: Bytes,
ret: Ret<TransformDeltas>,
},
Insert {
index: usize,
data: String,
ret: Ret<Delta>,
},
Delete {
interval: Interval,
ret: Ret<Delta>,
},
Format {
interval: Interval,
attribute: Attribute,
ret: Ret<Delta>,
},
Replace {
interval: Interval,
data: String,
ret: Ret<Delta>,
},
CanUndo {
ret: oneshot::Sender<bool>,
},
CanRedo {
ret: oneshot::Sender<bool>,
},
Undo {
ret: Ret<UndoResult>,
},
Redo {
ret: Ret<UndoResult>,
},
Doc {
ret: Ret<String>,
},
}
pub struct TransformDeltas {
pub client_prime: Delta,
pub server_prime: Delta,
pub server_rev_id: RevId,
}

View File

@ -1,18 +1,15 @@
use crate::{
entities::{
doc::{DocDelta, RevId, RevType, Revision, RevisionRange},
ws::{WsDataType, WsDocumentData},
},
entities::ws::{WsDataType, WsDocumentData},
errors::{internal_error, DocError, DocResult},
module::DocumentUser,
services::{
doc::{
edit::{
doc_actor::DocumentActor,
message::{DocumentMsg, TransformDeltas},
model::OpenDocAction,
},
revision::{RevisionManager, RevisionServer},
DocumentActor,
DocumentMsg,
OpenDocAction,
RevisionManager,
RevisionServer,
TransformDeltas,
UndoResult,
},
ws::{DocumentWebSocket, WsDocumentHandler},
@ -20,6 +17,7 @@ use crate::{
};
use bytes::Bytes;
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{DocDelta, RevId, RevType, Revision, RevisionRange};
use flowy_infra::retry::{ExponentialBackoff, Retry};
use flowy_ot::core::{Attribute, Delta, Interval};
use flowy_ws::WsState;

View File

@ -1,59 +0,0 @@
use crate::{errors::DocResult, services::doc::UndoResult};
use flowy_ot::core::{Attribute, Delta, Interval};
use crate::entities::doc::RevId;
use bytes::Bytes;
use tokio::sync::oneshot;
pub type Ret<T> = oneshot::Sender<DocResult<T>>;
pub enum DocumentMsg {
Delta {
delta: Delta,
ret: Ret<()>,
},
RemoteRevision {
bytes: Bytes,
ret: Ret<TransformDeltas>,
},
Insert {
index: usize,
data: String,
ret: Ret<Delta>,
},
Delete {
interval: Interval,
ret: Ret<Delta>,
},
Format {
interval: Interval,
attribute: Attribute,
ret: Ret<Delta>,
},
Replace {
interval: Interval,
data: String,
ret: Ret<Delta>,
},
CanUndo {
ret: oneshot::Sender<bool>,
},
CanRedo {
ret: oneshot::Sender<bool>,
},
Undo {
ret: Ret<UndoResult>,
},
Redo {
ret: Ret<UndoResult>,
},
Doc {
ret: Ret<String>,
},
}
pub struct TransformDeltas {
pub client_prime: Delta,
pub server_prime: Delta,
pub server_rev_id: RevId,
}

View File

@ -1,6 +1,7 @@
mod doc_actor;
mod edit_doc;
mod message;
mod model;
pub(crate) use doc_actor::*;
pub use edit_doc::*;
pub(crate) use model::*;

View File

@ -1,8 +1,5 @@
use crate::{
entities::doc::{NewDocUser, RevId},
errors::DocError,
services::ws::DocumentWebSocket,
};
use crate::{errors::DocError, services::ws::DocumentWebSocket};
use flowy_document_infra::entities::doc::{NewDocUser, RevId};
use flowy_infra::retry::Action;
use futures::future::BoxFuture;
use std::{future, sync::Arc};

View File

@ -1,7 +1,7 @@
use crate::services::doc::extensions::DeleteExt;
use flowy_document_infra::util::is_newline;
use flowy_ot::core::{plain_attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, Interval, NEW_LINE};
use crate::services::{doc::extensions::DeleteExt, util::is_newline};
pub struct PreserveLineFormatOnMerge {}
impl DeleteExt for PreserveLineFormatOnMerge {
fn ext_name(&self) -> &str { "PreserveLineFormatOnMerge" }

View File

@ -1,4 +1,4 @@
use crate::services::util::find_newline;
use flowy_document_infra::util::find_newline;
use flowy_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, Operation};
pub(crate) fn line_break(op: &Operation, attribute: &Attribute, scope: AttributeScope) -> Delta {

View File

@ -1,10 +1,7 @@
use crate::services::doc::extensions::{format::helper::line_break, FormatExt};
use flowy_document_infra::util::find_newline;
use flowy_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
use crate::services::{
doc::extensions::{format::helper::line_break, FormatExt},
util::find_newline,
};
pub struct ResolveBlockFormat {}
impl FormatExt for ResolveBlockFormat {
fn ext_name(&self) -> &str { std::any::type_name::<ResolveBlockFormat>() }

View File

@ -1,10 +1,7 @@
use crate::services::doc::extensions::{format::helper::line_break, FormatExt};
use flowy_document_infra::util::find_newline;
use flowy_ot::core::{Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
use crate::services::{
doc::extensions::{format::helper::line_break, FormatExt},
util::find_newline,
};
pub struct ResolveInlineFormat {}
impl FormatExt for ResolveInlineFormat {
fn ext_name(&self) -> &str { std::any::type_name::<ResolveInlineFormat>() }

View File

@ -1,7 +1,7 @@
use crate::services::doc::extensions::InsertExt;
use flowy_document_infra::util::is_newline;
use flowy_ot::core::{attributes_except_header, is_empty_line_at_index, AttributeKey, Delta, DeltaBuilder, DeltaIter};
use crate::services::{doc::extensions::InsertExt, util::is_newline};
pub struct AutoExitBlock {}
impl InsertExt for AutoExitBlock {

View File

@ -1,10 +1,9 @@
use crate::services::doc::extensions::InsertExt;
use flowy_document_infra::util::is_whitespace;
use flowy_ot::core::{count_utf16_code_units, plain_attributes, Attribute, Attributes, Delta, DeltaBuilder, DeltaIter};
use std::cmp::min;
use url::Url;
use flowy_ot::core::{count_utf16_code_units, plain_attributes, Attribute, Attributes, Delta, DeltaBuilder, DeltaIter};
use crate::services::{doc::extensions::InsertExt, util::is_whitespace};
pub struct AutoFormatExt {}
impl InsertExt for AutoFormatExt {
fn ext_name(&self) -> &str { std::any::type_name::<AutoFormatExt>() }

View File

@ -10,7 +10,8 @@ use flowy_ot::core::{
NEW_LINE,
};
use crate::services::{doc::extensions::InsertExt, util::is_newline};
use crate::services::doc::extensions::InsertExt;
use flowy_document_infra::util::is_newline;
pub struct PreserveBlockFormatOnInsert {}
impl InsertExt for PreserveBlockFormatOnInsert {

View File

@ -1,10 +1,7 @@
use crate::services::doc::extensions::InsertExt;
use flowy_document_infra::util::{contain_newline, is_newline};
use flowy_ot::core::{plain_attributes, AttributeKey, Delta, DeltaBuilder, DeltaIter, OpNewline, NEW_LINE};
use crate::services::{
doc::extensions::InsertExt,
util::{contain_newline, is_newline},
};
pub struct PreserveInlineFormat {}
impl InsertExt for PreserveInlineFormat {
fn ext_name(&self) -> &str { std::any::type_name::<PreserveInlineFormat>() }

View File

@ -1,7 +1,7 @@
use crate::services::doc::extensions::InsertExt;
use flowy_document_infra::util::is_newline;
use flowy_ot::core::{AttributeKey, Attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, NEW_LINE};
use crate::services::{doc::extensions::InsertExt, util::is_newline};
pub struct ResetLineFormatOnNewLine {}
impl InsertExt for ResetLineFormatOnNewLine {
fn ext_name(&self) -> &str { std::any::type_name::<ResetLineFormatOnNewLine>() }

View File

@ -7,6 +7,10 @@ mod history;
mod view;
pub(crate) mod doc_controller;
pub mod edit;
pub mod extensions;
mod edit;
mod extensions;
mod revision;
pub use edit::*;
pub(crate) use revision::*;

View File

@ -1,9 +1,12 @@
use crate::{
entities::doc::{Doc, RevId, RevType, Revision, RevisionRange},
errors::{DocError, DocResult},
services::{doc::revision::RevisionStore, util::RevIdCounter},
services::doc::revision::RevisionStore,
};
use flowy_database::ConnectionPool;
use flowy_document_infra::{
entities::doc::{Doc, RevId, RevType, Revision, RevisionRange},
util::RevIdCounter,
};
use flowy_infra::future::ResultFuture;
use flowy_ot::core::{Delta, OperationTransformable};
use std::sync::Arc;

View File

@ -1,10 +1,9 @@
use crate::{
entities::doc::{Revision, RevisionRange},
errors::{internal_error, DocError, DocResult},
sql_tables::{RevState, RevTableSql},
};
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{Revision, RevisionRange};
use flowy_infra::future::ResultFuture;
use std::sync::Arc;

View File

@ -1,5 +1,4 @@
use crate::{
entities::doc::{revision_from_doc, Doc, RevId, RevType, Revision, RevisionRange},
errors::{internal_error, DocError, DocResult},
services::doc::revision::{model::*, RevisionServer},
sql_tables::RevState,
@ -7,6 +6,7 @@ use crate::{
use async_stream::stream;
use dashmap::DashMap;
use flowy_database::{ConnectionPool, SqliteConnection};
use flowy_document_infra::entities::doc::{revision_from_doc, Doc, RevId, RevType, Revision, RevisionRange};
use flowy_infra::future::ResultFuture;
use flowy_ot::core::{Delta, Operation, OperationTransformable};
use futures::stream::StreamExt;
@ -190,13 +190,7 @@ async fn fetch_from_local(doc_id: &str, persistence: Arc<Persistence>) -> DocRes
let base_rev_id: RevId = revisions.last().unwrap().base_rev_id.into();
let rev_id: RevId = revisions.last().unwrap().rev_id.into();
let mut delta = Delta::new();
let mut pre_rev_id = 0;
for (_, revision) in revisions.into_iter().enumerate() {
pre_rev_id = revision.rev_id;
#[cfg(debug_assertions)]
validate_rev_id(pre_rev_id, revision.rev_id);
match Delta::from_bytes(revision.delta_data) {
Ok(local_delta) => {
delta = delta.compose(&local_delta)?;
@ -231,13 +225,6 @@ async fn fetch_from_local(doc_id: &str, persistence: Arc<Persistence>) -> DocRes
.map_err(internal_error)?
}
#[cfg(debug_assertions)]
fn validate_rev_id(current: i64, next: i64) {
if current >= next {
log::error!("The next revision id should be greater than the previous");
}
}
#[cfg(debug_assertions)]
fn validate_delta(doc_id: &str, persistence: Arc<Persistence>, conn: &SqliteConnection, delta: &Delta) {
if delta.ops.last().is_none() {

View File

@ -1,5 +1,4 @@
mod cache;
pub mod doc;
pub mod server;
pub(crate) mod util;
pub mod ws;

View File

@ -4,10 +4,8 @@ mod server_api_mock;
pub use server_api::*;
// TODO: ignore mock files in production
use crate::{
entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams},
errors::DocError,
};
use crate::errors::DocError;
use flowy_document_infra::entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
use flowy_infra::future::ResultFuture;
use flowy_net::config::ServerConfig;
pub use server_api_mock::*;

View File

@ -1,8 +1,5 @@
use crate::{
entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams},
errors::DocError,
services::server::DocumentServerAPI,
};
use crate::{errors::DocError, services::server::DocumentServerAPI};
use flowy_document_infra::entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
use flowy_infra::future::ResultFuture;
use flowy_net::{config::*, request::HttpRequestBuilder};

View File

@ -1,7 +1,7 @@
use crate::{
use crate::{errors::DocError, services::server::DocumentServerAPI};
use flowy_document_infra::{
document_default::doc_initial_string,
entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams},
errors::DocError,
services::{doc::doc_initial_string, server::DocumentServerAPI},
};
use flowy_infra::future::ResultFuture;

View File

@ -1,10 +1,10 @@
use crate::{
entities::doc::{Revision, RevisionRange},
errors::DocError,
sql_tables::{doc::RevTable, RevChangeset, RevState, RevTableType},
};
use diesel::update;
use flowy_database::{insert_or_ignore_into, prelude::*, schema::rev_table::dsl, SqliteConnection};
use flowy_document_infra::entities::doc::{Revision, RevisionRange};
pub struct RevTableSql {}

View File

@ -1,9 +1,9 @@
use crate::{
entities::doc::{RevId, RevType, Revision},
services::util::md5,
};
use diesel::sql_types::Integer;
use flowy_database::schema::rev_table;
use flowy_document_infra::{
entities::doc::{RevId, RevType, Revision},
util::md5,
};
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]
#[table_name = "rev_table"]

View File

@ -1,14 +1,14 @@
use bytes::Bytes;
use flowy_document::{
errors::DocError,
entities::ws::WsDocumentData,
errors::{internal_error, DocError},
module::DocumentUser,
prelude::{DocumentWebSocket, WsDocumentManager},
services::ws::WsStateReceiver,
};
use flowy_document::{entities::ws::WsDocumentData, errors::internal_error, services::ws::WsStateReceiver};
use flowy_user::{errors::ErrorCode, services::user::UserSession};
use flowy_ws::{WsMessage, WsMessageHandler, WsModule};
use flowy_document::services::ws::{DocumentWebSocket, WsDocumentManager};
use flowy_user::errors::UserError;
use std::{path::Path, sync::Arc};

View File

@ -4,7 +4,7 @@ pub mod module;
use crate::deps_resolve::WorkspaceDepsResolver;
use flowy_dispatch::prelude::*;
use flowy_document::prelude::FlowyDocument;
use flowy_document::module::FlowyDocument;
use flowy_net::config::ServerConfig;
use flowy_user::services::user::{UserSession, UserSessionBuilder, UserStatus};
use flowy_workspace::{errors::WorkspaceError, prelude::WorkspaceController};

View File

@ -12,6 +12,7 @@ flowy-user = { path = "../flowy-user"}
flowy-workspace = { path = "../flowy-workspace", default-features = false}
flowy-infra = { path = "../flowy-infra"}
flowy-document = { path = "../flowy-document"}
flowy-document-infra = { path = "../flowy-document-infra"}
flowy-net = { path = "../flowy-net"}
serde = { version = "1.0", features = ["derive"] }

View File

@ -1,5 +1,5 @@
use crate::prelude::*;
use flowy_document::entities::doc::Doc;
use flowy_document_infra::entities::doc::Doc;
use flowy_workspace::{
entities::{
app::*,

View File

@ -14,7 +14,7 @@ strum = "0.21"
strum_macros = "0.21"
derive_more = {version = "0.99", features = ["display"]}
log = "0.4.14"
flowy-document = { path = "../flowy-document" }
flowy-document-infra = { path = "../flowy-document-infra" }
uuid = { version = "0.8", features = ["serde", "v4"] }
chrono = { version = "0.4" }

View File

@ -8,7 +8,7 @@ use crate::{
},
};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_document::services::doc::doc_initial_string;
use flowy_document_infra::document_default::doc_initial_string;
use std::convert::TryInto;
#[derive(PartialEq, Debug, ProtoBuf_Enum, Clone)]

View File

@ -1,6 +1,6 @@
use crate::{errors::ErrorCode, parser::view::ViewId};
use flowy_derive::ProtoBuf;
use flowy_document::entities::doc::DocIdentifier;
use flowy_document_infra::entities::doc::DocIdentifier;
use std::convert::TryInto;
#[derive(Default, ProtoBuf)]

View File

@ -7,13 +7,14 @@ edition = "2018"
[dependencies]
flowy-workspace-infra = { path = "../flowy-workspace-infra" }
flowy-document-infra = { path = "../flowy-document-infra" }
flowy-document = { path = "../flowy-document" }
flowy-dispatch = { path = "../flowy-dispatch" }
flowy-derive = { path = "../flowy-derive" }
flowy-database = { path = "../flowy-database" }
flowy-sqlite = { path = "../flowy-sqlite" }
flowy-infra = { path = "../flowy-infra" }
flowy-dart-notify = { path = "../flowy-dart-notify" }
flowy-document = { path = "../flowy-document" }
flowy-ot = { path = "../flowy-ot" }
flowy-net = { path = "../flowy-net", features = ["flowy_request"] }
flowy-backend-api = { path = "../flowy-backend-api"}

View File

@ -16,7 +16,7 @@ use crate::{
services::{TrashCan, ViewController},
};
use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
use flowy_document::entities::doc::DocDelta;
use flowy_document_infra::entities::doc::DocDelta;
use flowy_workspace_infra::entities::share::{ExportData, ExportParams, ExportRequest};
use std::{convert::TryInto, sync::Arc};

View File

@ -1,12 +1,7 @@
use std::{collections::HashSet, sync::Arc};
use futures::{FutureExt, StreamExt};
use flowy_database::SqliteConnection;
use flowy_document::{
entities::doc::{DocDelta, DocIdentifier},
module::FlowyDocument,
};
use flowy_document_infra::entities::doc::{DocDelta, DocIdentifier};
use futures::{FutureExt, StreamExt};
use std::{collections::HashSet, sync::Arc};
use crate::{
entities::{
@ -19,6 +14,7 @@ use crate::{
services::{server::Server, TrashCan, TrashEvent},
sql_tables::view::{ViewTable, ViewTableChangeset, ViewTableSql},
};
use flowy_document::module::FlowyDocument;
use flowy_infra::kv::KV;
use flowy_workspace_infra::entities::share::{ExportData, ExportParams};