mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
fix warnings
This commit is contained in:
parent
64ea2d4f31
commit
463cab6eee
31 changed files with 438 additions and 375 deletions
|
@ -11,7 +11,7 @@ use backend_service::errors::ServerError;
|
||||||
use flowy_collaboration::{
|
use flowy_collaboration::{
|
||||||
core::sync::{DocumentPersistence, ServerDocumentManager},
|
core::sync::{DocumentPersistence, ServerDocumentManager},
|
||||||
entities::{
|
entities::{
|
||||||
doc::{CreateDocParams, Doc},
|
doc::{CreateDocParams, DocumentInfo},
|
||||||
revision::{RepeatedRevision, Revision},
|
revision::{RepeatedRevision, Revision},
|
||||||
},
|
},
|
||||||
errors::CollaborateError,
|
errors::CollaborateError,
|
||||||
|
@ -86,7 +86,7 @@ impl DocumentPersistence for DocumentPersistenceImpl {
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
fn read_doc(&self, doc_id: &str) -> FutureResultSend<Doc, CollaborateError> {
|
fn read_doc(&self, doc_id: &str) -> FutureResultSend<DocumentInfo, CollaborateError> {
|
||||||
let params = DocIdentifier {
|
let params = DocIdentifier {
|
||||||
doc_id: doc_id.to_string(),
|
doc_id: doc_id.to_string(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -103,10 +103,10 @@ impl DocumentPersistence for DocumentPersistenceImpl {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_doc(&self, revision: Revision) -> FutureResultSend<Doc, CollaborateError> {
|
fn create_doc(&self, revision: Revision) -> FutureResultSend<DocumentInfo, CollaborateError> {
|
||||||
let kv_store = self.0.kv_store();
|
let kv_store = self.0.kv_store();
|
||||||
FutureResultSend::new(async move {
|
FutureResultSend::new(async move {
|
||||||
let doc: Doc = revision.clone().try_into()?;
|
let doc: DocumentInfo = revision.clone().try_into()?;
|
||||||
let doc_id = revision.doc_id.clone();
|
let doc_id = revision.doc_id.clone();
|
||||||
let revisions = RepeatedRevision { items: vec![revision] };
|
let revisions = RepeatedRevision { items: vec![revision] };
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
use crate::{context::FlowyPersistence, services::document::persistence::DocumentKVPersistence};
|
use crate::{context::FlowyPersistence, services::document::persistence::DocumentKVPersistence};
|
||||||
|
|
||||||
use backend_service::errors::{internal_error, ServerError};
|
use backend_service::errors::{internal_error, ServerError};
|
||||||
use flowy_collaboration::protobuf::{CreateDocParams, Doc, DocIdentifier, RepeatedRevision, ResetDocumentParams};
|
use flowy_collaboration::protobuf::{
|
||||||
|
CreateDocParams,
|
||||||
|
DocIdentifier,
|
||||||
|
DocumentInfo,
|
||||||
|
RepeatedRevision,
|
||||||
|
ResetDocumentParams,
|
||||||
|
};
|
||||||
use lib_ot::{core::OperationTransformable, rich_text::RichTextDelta};
|
use lib_ot::{core::OperationTransformable, rich_text::RichTextDelta};
|
||||||
use protobuf::Message;
|
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
const DOC_TABLE: &str = "doc_table";
|
|
||||||
|
|
||||||
#[tracing::instrument(level = "debug", skip(kv_store), err)]
|
#[tracing::instrument(level = "debug", skip(kv_store), err)]
|
||||||
pub(crate) async fn create_doc(
|
pub(crate) async fn create_doc(
|
||||||
kv_store: &Arc<DocumentKVPersistence>,
|
kv_store: &Arc<DocumentKVPersistence>,
|
||||||
|
@ -21,7 +23,10 @@ pub(crate) async fn create_doc(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "debug", skip(persistence), err)]
|
#[tracing::instrument(level = "debug", skip(persistence), err)]
|
||||||
pub(crate) async fn read_doc(persistence: &Arc<FlowyPersistence>, params: DocIdentifier) -> Result<Doc, ServerError> {
|
pub(crate) async fn read_doc(
|
||||||
|
persistence: &Arc<FlowyPersistence>,
|
||||||
|
params: DocIdentifier,
|
||||||
|
) -> Result<DocumentInfo, ServerError> {
|
||||||
let _ = Uuid::parse_str(¶ms.doc_id)?;
|
let _ = Uuid::parse_str(¶ms.doc_id)?;
|
||||||
|
|
||||||
let kv_store = persistence.kv_store();
|
let kv_store = persistence.kv_store();
|
||||||
|
@ -37,7 +42,6 @@ pub async fn reset_document(_pool: &PgPool, _params: ResetDocumentParams) -> Res
|
||||||
#[tracing::instrument(level = "debug", skip(kv_store), err)]
|
#[tracing::instrument(level = "debug", skip(kv_store), err)]
|
||||||
pub(crate) async fn delete_doc(kv_store: &Arc<DocumentKVPersistence>, doc_id: Uuid) -> Result<(), ServerError> {
|
pub(crate) async fn delete_doc(kv_store: &Arc<DocumentKVPersistence>, doc_id: Uuid) -> Result<(), ServerError> {
|
||||||
let _ = kv_store.batch_delete_revisions(&doc_id.to_string(), None).await?;
|
let _ = kv_store.batch_delete_revisions(&doc_id.to_string(), None).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ struct DocTable {
|
||||||
rev_id: i64,
|
rev_id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_doc_from_revisions(doc_id: &str, mut revisions: RepeatedRevision) -> Result<Doc, ServerError> {
|
fn make_doc_from_revisions(doc_id: &str, mut revisions: RepeatedRevision) -> Result<DocumentInfo, ServerError> {
|
||||||
let revisions = revisions.take_items();
|
let revisions = revisions.take_items();
|
||||||
let mut document_delta = RichTextDelta::new();
|
let mut document_delta = RichTextDelta::new();
|
||||||
let mut base_rev_id = 0;
|
let mut base_rev_id = 0;
|
||||||
|
@ -60,10 +64,10 @@ fn make_doc_from_revisions(doc_id: &str, mut revisions: RepeatedRevision) -> Res
|
||||||
document_delta = document_delta.compose(&delta).map_err(internal_error)?;
|
document_delta = document_delta.compose(&delta).map_err(internal_error)?;
|
||||||
}
|
}
|
||||||
let text = document_delta.to_json();
|
let text = document_delta.to_json();
|
||||||
let mut doc = Doc::new();
|
let mut document_info = DocumentInfo::new();
|
||||||
doc.set_id(doc_id.to_owned());
|
document_info.set_id(doc_id.to_owned());
|
||||||
doc.set_text(text);
|
document_info.set_text(text);
|
||||||
doc.set_base_rev_id(base_rev_id);
|
document_info.set_base_rev_id(base_rev_id);
|
||||||
doc.set_rev_id(rev_id);
|
document_info.set_rev_id(rev_id);
|
||||||
Ok(doc)
|
Ok(document_info)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,9 @@ use flowy_core_data_model::entities::view::ViewIdentifiers;
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn doc_read() {
|
async fn doc_read() {
|
||||||
let test = ViewTest::new().await;
|
let test = ViewTest::new().await;
|
||||||
|
|
||||||
let params = DocIdentifier {
|
let params = DocIdentifier {
|
||||||
doc_id: test.view.id.clone(),
|
doc_id: test.view.id.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let doc = test.server.read_doc(params).await;
|
let doc = test.server.read_doc(params).await;
|
||||||
assert_eq!(doc.is_some(), true);
|
assert_eq!(doc.is_some(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ async fn delta_sync_while_editing_with_attribute() {
|
||||||
// │ops: ["123", "456"] rev: 2│ │ │
|
// │ops: ["123", "456"] rev: 2│ │ │
|
||||||
// └──────────────────────────┘ │ │
|
// └──────────────────────────┘ │ │
|
||||||
// │ │
|
// │ │
|
||||||
// ◀── http request ─┤ Open document_test
|
// ◀── http request ─┤ Open doc
|
||||||
// │ │
|
// │ │
|
||||||
// │ │ ┌──────────────────────────┐
|
// │ │ ┌──────────────────────────┐
|
||||||
// ├──http response──┼─▶│ops: ["123", "456"] rev: 2│
|
// ├──http response──┼─▶│ops: ["123", "456"] rev: 2│
|
||||||
|
@ -115,7 +115,7 @@ async fn delta_sync_with_server_push_delta() {
|
||||||
// └─────────┘ └─────────┘
|
// └─────────┘ └─────────┘
|
||||||
// │ │
|
// │ │
|
||||||
// │ │
|
// │ │
|
||||||
// ◀── http request ─┤ Open document_test
|
// ◀── http request ─┤ Open doc
|
||||||
// │ │
|
// │ │
|
||||||
// │ │ ┌───────────────┐
|
// │ │ ┌───────────────┐
|
||||||
// ├──http response──┼─▶│ops: [] rev: 0 │
|
// ├──http response──┼─▶│ops: [] rev: 0 │
|
||||||
|
@ -165,7 +165,7 @@ async fn delta_sync_while_local_rev_less_than_server_rev() {
|
||||||
// ┌───────────────────┐ │ │
|
// ┌───────────────────┐ │ │
|
||||||
// │ops: ["123"] rev: 1│ │ │
|
// │ops: ["123"] rev: 1│ │ │
|
||||||
// └───────────────────┘ │ │
|
// └───────────────────┘ │ │
|
||||||
// ◀── http request ─┤ Open document_test
|
// ◀── http request ─┤ Open doc
|
||||||
// │ │
|
// │ │
|
||||||
// │ │ ┌───────────────┐
|
// │ │ ┌───────────────┐
|
||||||
// ├──http response──┼──▶│ops: [123] rev:│
|
// ├──http response──┼──▶│ops: [123] rev:│
|
||||||
|
|
|
@ -9,7 +9,7 @@ use backend_service::{
|
||||||
user_request::*,
|
user_request::*,
|
||||||
workspace_request::*,
|
workspace_request::*,
|
||||||
};
|
};
|
||||||
use flowy_collaboration::entities::doc::{Doc, DocIdentifier};
|
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentInfo};
|
||||||
use flowy_core_data_model::entities::prelude::*;
|
use flowy_core_data_model::entities::prelude::*;
|
||||||
use flowy_document::services::server::read_doc_request;
|
use flowy_document::services::server::read_doc_request;
|
||||||
use flowy_user_data_model::entities::*;
|
use flowy_user_data_model::entities::*;
|
||||||
|
@ -149,8 +149,8 @@ impl TestUserServer {
|
||||||
read_trash_request(self.user_token(), &url).await.unwrap()
|
read_trash_request(self.user_token(), &url).await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn read_doc(&self, params: DocIdentifier) -> Option<Doc> {
|
pub async fn read_doc(&self, params: DocIdentifier) -> Option<DocumentInfo> {
|
||||||
let url = format!("{}/api/document_test", self.http_addr());
|
let url = format!("{}/api/doc", self.http_addr());
|
||||||
let doc = read_doc_request(self.user_token(), params, &url).await.unwrap();
|
let doc = read_doc_request(self.user_token(), params, &url).await.unwrap();
|
||||||
doc
|
doc
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class DocBloc extends Bloc<DocEvent, DocState> {
|
||||||
final result = await docManager.readDoc();
|
final result = await docManager.readDoc();
|
||||||
yield result.fold(
|
yield result.fold(
|
||||||
(doc) {
|
(doc) {
|
||||||
document = _decodeJsonToDocument(doc.data);
|
document = _decodeJsonToDocument(doc.text);
|
||||||
_subscription = document.changes.listen((event) {
|
_subscription = document.changes.listen((event) {
|
||||||
final delta = event.item2;
|
final delta = event.item2;
|
||||||
final documentDelta = document.toDelta();
|
final documentDelta = document.toDelta();
|
||||||
|
@ -113,7 +113,7 @@ class DocBloc extends Bloc<DocEvent, DocState> {
|
||||||
|
|
||||||
result.fold((rustDoc) {
|
result.fold((rustDoc) {
|
||||||
// final json = utf8.decode(doc.data);
|
// final json = utf8.decode(doc.data);
|
||||||
final rustDelta = Delta.fromJson(jsonDecode(rustDoc.data));
|
final rustDelta = Delta.fromJson(jsonDecode(rustDoc.text));
|
||||||
if (documentDelta != rustDelta) {
|
if (documentDelta != rustDelta) {
|
||||||
Log.error("Receive : $rustDelta");
|
Log.error("Receive : $rustDelta");
|
||||||
Log.error("Expected : $documentDelta");
|
Log.error("Expected : $documentDelta");
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flowy_sdk/protobuf/flowy-collaboration/doc.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
|
|
||||||
abstract class IDoc {
|
abstract class IDoc {
|
||||||
Future<Either<DocDelta, FlowyError>> readDoc();
|
Future<Either<DocumentDelta, FlowyError>> readDoc();
|
||||||
Future<Either<DocDelta, FlowyError>> composeDelta({required String json});
|
Future<Either<DocumentDelta, FlowyError>> composeDelta({required String json});
|
||||||
Future<Either<Unit, FlowyError>> closeDoc();
|
Future<Either<Unit, FlowyError>> closeDoc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,13 @@ class IDocImpl extends IDoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Either<DocDelta, FlowyError>> readDoc() async {
|
Future<Either<DocumentDelta, FlowyError>> readDoc() async {
|
||||||
final docOrFail = await repo.readDoc();
|
final docOrFail = await repo.readDoc();
|
||||||
return docOrFail;
|
return docOrFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Either<DocDelta, FlowyError>> composeDelta({required String json}) {
|
Future<Either<DocumentDelta, FlowyError>> composeDelta({required String json}) {
|
||||||
return repo.composeDelta(data: json);
|
return repo.composeDelta(data: json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,15 @@ class DocRepository {
|
||||||
required this.docId,
|
required this.docId,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<Either<DocDelta, FlowyError>> readDoc() {
|
Future<Either<DocumentDelta, FlowyError>> readDoc() {
|
||||||
final request = QueryViewRequest(viewIds: [docId]);
|
final request = QueryViewRequest(viewIds: [docId]);
|
||||||
return WorkspaceEventOpenView(request).send();
|
return WorkspaceEventOpenView(request).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<DocDelta, FlowyError>> composeDelta({required String data}) {
|
Future<Either<DocumentDelta, FlowyError>> composeDelta({required String data}) {
|
||||||
final request = DocDelta.create()
|
final request = DocumentDelta.create()
|
||||||
..docId = docId
|
..docId = docId
|
||||||
..data = data;
|
..text = data;
|
||||||
return WorkspaceEventApplyDocDelta(request).send();
|
return WorkspaceEventApplyDocDelta(request).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,14 +272,14 @@ class WorkspaceEventOpenView {
|
||||||
QueryViewRequest request;
|
QueryViewRequest request;
|
||||||
WorkspaceEventOpenView(this.request);
|
WorkspaceEventOpenView(this.request);
|
||||||
|
|
||||||
Future<Either<DocDelta, FlowyError>> send() {
|
Future<Either<DocumentDelta, FlowyError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = WorkspaceEvent.OpenView.toString()
|
..event = WorkspaceEvent.OpenView.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
.then((bytesResult) => bytesResult.fold(
|
.then((bytesResult) => bytesResult.fold(
|
||||||
(okBytes) => left(DocDelta.fromBuffer(okBytes)),
|
(okBytes) => left(DocumentDelta.fromBuffer(okBytes)),
|
||||||
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
|
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -379,17 +379,17 @@ class WorkspaceEventDeleteAll {
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkspaceEventApplyDocDelta {
|
class WorkspaceEventApplyDocDelta {
|
||||||
DocDelta request;
|
DocumentDelta request;
|
||||||
WorkspaceEventApplyDocDelta(this.request);
|
WorkspaceEventApplyDocDelta(this.request);
|
||||||
|
|
||||||
Future<Either<DocDelta, FlowyError>> send() {
|
Future<Either<DocumentDelta, FlowyError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = WorkspaceEvent.ApplyDocDelta.toString()
|
..event = WorkspaceEvent.ApplyDocDelta.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
.then((bytesResult) => bytesResult.fold(
|
.then((bytesResult) => bytesResult.fold(
|
||||||
(okBytes) => left(DocDelta.fromBuffer(okBytes)),
|
(okBytes) => left(DocumentDelta.fromBuffer(okBytes)),
|
||||||
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
|
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,13 @@ import 'package:protobuf/protobuf.dart' as $pb;
|
||||||
import 'revision.pb.dart' as $0;
|
import 'revision.pb.dart' as $0;
|
||||||
|
|
||||||
class CreateDocParams extends $pb.GeneratedMessage {
|
class CreateDocParams extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CreateDocParams', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CreateDocParams',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
|
||||||
..aOM<$0.RepeatedRevision>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revisions', subBuilder: $0.RepeatedRevision.create)
|
..aOM<$0.RepeatedRevision>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revisions',
|
||||||
..hasRequiredFields = false
|
subBuilder: $0.RepeatedRevision.create)
|
||||||
;
|
..hasRequiredFields = false;
|
||||||
|
|
||||||
CreateDocParams._() : super();
|
CreateDocParams._() : super();
|
||||||
factory CreateDocParams({
|
factory CreateDocParams({
|
||||||
|
@ -33,31 +35,38 @@ class CreateDocParams extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory CreateDocParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory CreateDocParams.fromBuffer($core.List<$core.int> i,
|
||||||
factory CreateDocParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
@$core.Deprecated(
|
create()..mergeFromBuffer(i, r);
|
||||||
'Using this can add significant overhead to your binary. '
|
factory CreateDocParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
create()..mergeFromJson(i, r);
|
||||||
'Will be removed in next major version')
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
|
'Will be removed in next major version')
|
||||||
CreateDocParams clone() => CreateDocParams()..mergeFromMessage(this);
|
CreateDocParams clone() => CreateDocParams()..mergeFromMessage(this);
|
||||||
@$core.Deprecated(
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Using this can add significant overhead to your binary. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Will be removed in next major version')
|
||||||
'Will be removed in next major version')
|
CreateDocParams copyWith(void Function(CreateDocParams) updates) =>
|
||||||
CreateDocParams copyWith(void Function(CreateDocParams) updates) => super.copyWith((message) => updates(message as CreateDocParams)) as CreateDocParams; // ignore: deprecated_member_use
|
super.copyWith((message) => updates(message as CreateDocParams))
|
||||||
|
as CreateDocParams; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static CreateDocParams create() => CreateDocParams._();
|
static CreateDocParams create() => CreateDocParams._();
|
||||||
CreateDocParams createEmptyInstance() => create();
|
CreateDocParams createEmptyInstance() => create();
|
||||||
static $pb.PbList<CreateDocParams> createRepeated() => $pb.PbList<CreateDocParams>();
|
static $pb.PbList<CreateDocParams> createRepeated() => $pb.PbList<CreateDocParams>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static CreateDocParams getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CreateDocParams>(create);
|
static CreateDocParams getDefault() =>
|
||||||
|
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CreateDocParams>(create);
|
||||||
static CreateDocParams? _defaultInstance;
|
static CreateDocParams? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get id => $_getSZ(0);
|
$core.String get id => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set id($core.String v) { $_setString(0, v); }
|
set id($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasId() => $_has(0);
|
$core.bool hasId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
|
@ -66,7 +75,10 @@ class CreateDocParams extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$0.RepeatedRevision get revisions => $_getN(1);
|
$0.RepeatedRevision get revisions => $_getN(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
set revisions($0.RepeatedRevision v) { setField(2, v); }
|
set revisions($0.RepeatedRevision v) {
|
||||||
|
setField(2, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.bool hasRevisions() => $_has(1);
|
$core.bool hasRevisions() => $_has(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
|
@ -75,17 +87,18 @@ class CreateDocParams extends $pb.GeneratedMessage {
|
||||||
$0.RepeatedRevision ensureRevisions() => $_ensure(1);
|
$0.RepeatedRevision ensureRevisions() => $_ensure(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Doc extends $pb.GeneratedMessage {
|
class DocumentInfo extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Doc', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocumentInfo',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
|
||||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'text')
|
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'text')
|
||||||
..aInt64(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revId')
|
..aInt64(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revId')
|
||||||
..aInt64(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'baseRevId')
|
..aInt64(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'baseRevId')
|
||||||
..hasRequiredFields = false
|
..hasRequiredFields = false;
|
||||||
;
|
|
||||||
|
|
||||||
Doc._() : super();
|
DocumentInfo._() : super();
|
||||||
factory Doc({
|
factory DocumentInfo({
|
||||||
$core.String? id,
|
$core.String? id,
|
||||||
$core.String? text,
|
$core.String? text,
|
||||||
$fixnum.Int64? revId,
|
$fixnum.Int64? revId,
|
||||||
|
@ -106,31 +119,35 @@ class Doc extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory Doc.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory DocumentInfo.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
factory Doc.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
create()..mergeFromBuffer(i, r);
|
||||||
@$core.Deprecated(
|
factory DocumentInfo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Using this can add significant overhead to your binary. '
|
create()..mergeFromJson(i, r);
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Will be removed in next major version')
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
Doc clone() => Doc()..mergeFromMessage(this);
|
'Will be removed in next major version')
|
||||||
@$core.Deprecated(
|
DocumentInfo clone() => DocumentInfo()..mergeFromMessage(this);
|
||||||
'Using this can add significant overhead to your binary. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Will be removed in next major version')
|
'Will be removed in next major version')
|
||||||
Doc copyWith(void Function(Doc) updates) => super.copyWith((message) => updates(message as Doc)) as Doc; // ignore: deprecated_member_use
|
DocumentInfo copyWith(void Function(DocumentInfo) updates) =>
|
||||||
|
super.copyWith((message) => updates(message as DocumentInfo)) as DocumentInfo; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static Doc create() => Doc._();
|
static DocumentInfo create() => DocumentInfo._();
|
||||||
Doc createEmptyInstance() => create();
|
DocumentInfo createEmptyInstance() => create();
|
||||||
static $pb.PbList<Doc> createRepeated() => $pb.PbList<Doc>();
|
static $pb.PbList<DocumentInfo> createRepeated() => $pb.PbList<DocumentInfo>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static Doc getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Doc>(create);
|
static DocumentInfo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DocumentInfo>(create);
|
||||||
static Doc? _defaultInstance;
|
static DocumentInfo? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get id => $_getSZ(0);
|
$core.String get id => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set id($core.String v) { $_setString(0, v); }
|
set id($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasId() => $_has(0);
|
$core.bool hasId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
|
@ -139,7 +156,10 @@ class Doc extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.String get text => $_getSZ(1);
|
$core.String get text => $_getSZ(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
set text($core.String v) { $_setString(1, v); }
|
set text($core.String v) {
|
||||||
|
$_setString(1, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.bool hasText() => $_has(1);
|
$core.bool hasText() => $_has(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
|
@ -148,7 +168,10 @@ class Doc extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
$fixnum.Int64 get revId => $_getI64(2);
|
$fixnum.Int64 get revId => $_getI64(2);
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
set revId($fixnum.Int64 v) { $_setInt64(2, v); }
|
set revId($fixnum.Int64 v) {
|
||||||
|
$_setInt64(2, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
$core.bool hasRevId() => $_has(2);
|
$core.bool hasRevId() => $_has(2);
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
|
@ -157,7 +180,10 @@ class Doc extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(4)
|
@$pb.TagNumber(4)
|
||||||
$fixnum.Int64 get baseRevId => $_getI64(3);
|
$fixnum.Int64 get baseRevId => $_getI64(3);
|
||||||
@$pb.TagNumber(4)
|
@$pb.TagNumber(4)
|
||||||
set baseRevId($fixnum.Int64 v) { $_setInt64(3, v); }
|
set baseRevId($fixnum.Int64 v) {
|
||||||
|
$_setInt64(3, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(4)
|
@$pb.TagNumber(4)
|
||||||
$core.bool hasBaseRevId() => $_has(3);
|
$core.bool hasBaseRevId() => $_has(3);
|
||||||
@$pb.TagNumber(4)
|
@$pb.TagNumber(4)
|
||||||
|
@ -165,11 +191,13 @@ class Doc extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ResetDocumentParams extends $pb.GeneratedMessage {
|
class ResetDocumentParams extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ResetDocumentParams', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ResetDocumentParams',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
||||||
..aOM<$0.RepeatedRevision>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revisions', subBuilder: $0.RepeatedRevision.create)
|
..aOM<$0.RepeatedRevision>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revisions',
|
||||||
..hasRequiredFields = false
|
subBuilder: $0.RepeatedRevision.create)
|
||||||
;
|
..hasRequiredFields = false;
|
||||||
|
|
||||||
ResetDocumentParams._() : super();
|
ResetDocumentParams._() : super();
|
||||||
factory ResetDocumentParams({
|
factory ResetDocumentParams({
|
||||||
|
@ -185,31 +213,38 @@ class ResetDocumentParams extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory ResetDocumentParams.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory ResetDocumentParams.fromBuffer($core.List<$core.int> i,
|
||||||
factory ResetDocumentParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
@$core.Deprecated(
|
create()..mergeFromBuffer(i, r);
|
||||||
'Using this can add significant overhead to your binary. '
|
factory ResetDocumentParams.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
create()..mergeFromJson(i, r);
|
||||||
'Will be removed in next major version')
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
|
'Will be removed in next major version')
|
||||||
ResetDocumentParams clone() => ResetDocumentParams()..mergeFromMessage(this);
|
ResetDocumentParams clone() => ResetDocumentParams()..mergeFromMessage(this);
|
||||||
@$core.Deprecated(
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Using this can add significant overhead to your binary. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Will be removed in next major version')
|
||||||
'Will be removed in next major version')
|
ResetDocumentParams copyWith(void Function(ResetDocumentParams) updates) =>
|
||||||
ResetDocumentParams copyWith(void Function(ResetDocumentParams) updates) => super.copyWith((message) => updates(message as ResetDocumentParams)) as ResetDocumentParams; // ignore: deprecated_member_use
|
super.copyWith((message) => updates(message as ResetDocumentParams))
|
||||||
|
as ResetDocumentParams; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static ResetDocumentParams create() => ResetDocumentParams._();
|
static ResetDocumentParams create() => ResetDocumentParams._();
|
||||||
ResetDocumentParams createEmptyInstance() => create();
|
ResetDocumentParams createEmptyInstance() => create();
|
||||||
static $pb.PbList<ResetDocumentParams> createRepeated() => $pb.PbList<ResetDocumentParams>();
|
static $pb.PbList<ResetDocumentParams> createRepeated() => $pb.PbList<ResetDocumentParams>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static ResetDocumentParams getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ResetDocumentParams>(create);
|
static ResetDocumentParams getDefault() =>
|
||||||
|
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ResetDocumentParams>(create);
|
||||||
static ResetDocumentParams? _defaultInstance;
|
static ResetDocumentParams? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get docId => $_getSZ(0);
|
$core.String get docId => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set docId($core.String v) { $_setString(0, v); }
|
set docId($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasDocId() => $_has(0);
|
$core.bool hasDocId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
|
@ -218,7 +253,10 @@ class ResetDocumentParams extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$0.RepeatedRevision get revisions => $_getN(1);
|
$0.RepeatedRevision get revisions => $_getN(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
set revisions($0.RepeatedRevision v) { setField(2, v); }
|
set revisions($0.RepeatedRevision v) {
|
||||||
|
setField(2, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.bool hasRevisions() => $_has(1);
|
$core.bool hasRevisions() => $_has(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
|
@ -227,74 +265,83 @@ class ResetDocumentParams extends $pb.GeneratedMessage {
|
||||||
$0.RepeatedRevision ensureRevisions() => $_ensure(1);
|
$0.RepeatedRevision ensureRevisions() => $_ensure(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocDelta extends $pb.GeneratedMessage {
|
class DocumentDelta extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocDelta', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocumentDelta',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
||||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data')
|
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'text')
|
||||||
..hasRequiredFields = false
|
..hasRequiredFields = false;
|
||||||
;
|
|
||||||
|
|
||||||
DocDelta._() : super();
|
DocumentDelta._() : super();
|
||||||
factory DocDelta({
|
factory DocumentDelta({
|
||||||
$core.String? docId,
|
$core.String? docId,
|
||||||
$core.String? data,
|
$core.String? text,
|
||||||
}) {
|
}) {
|
||||||
final _result = create();
|
final _result = create();
|
||||||
if (docId != null) {
|
if (docId != null) {
|
||||||
_result.docId = docId;
|
_result.docId = docId;
|
||||||
}
|
}
|
||||||
if (data != null) {
|
if (text != null) {
|
||||||
_result.data = data;
|
_result.text = text;
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory DocDelta.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory DocumentDelta.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
factory DocDelta.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
create()..mergeFromBuffer(i, r);
|
||||||
@$core.Deprecated(
|
factory DocumentDelta.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Using this can add significant overhead to your binary. '
|
create()..mergeFromJson(i, r);
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Will be removed in next major version')
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
DocDelta clone() => DocDelta()..mergeFromMessage(this);
|
'Will be removed in next major version')
|
||||||
@$core.Deprecated(
|
DocumentDelta clone() => DocumentDelta()..mergeFromMessage(this);
|
||||||
'Using this can add significant overhead to your binary. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Will be removed in next major version')
|
'Will be removed in next major version')
|
||||||
DocDelta copyWith(void Function(DocDelta) updates) => super.copyWith((message) => updates(message as DocDelta)) as DocDelta; // ignore: deprecated_member_use
|
DocumentDelta copyWith(void Function(DocumentDelta) updates) =>
|
||||||
|
super.copyWith((message) => updates(message as DocumentDelta)) as DocumentDelta; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static DocDelta create() => DocDelta._();
|
static DocumentDelta create() => DocumentDelta._();
|
||||||
DocDelta createEmptyInstance() => create();
|
DocumentDelta createEmptyInstance() => create();
|
||||||
static $pb.PbList<DocDelta> createRepeated() => $pb.PbList<DocDelta>();
|
static $pb.PbList<DocumentDelta> createRepeated() => $pb.PbList<DocumentDelta>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static DocDelta getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DocDelta>(create);
|
static DocumentDelta getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DocumentDelta>(create);
|
||||||
static DocDelta? _defaultInstance;
|
static DocumentDelta? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get docId => $_getSZ(0);
|
$core.String get docId => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set docId($core.String v) { $_setString(0, v); }
|
set docId($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasDocId() => $_has(0);
|
$core.bool hasDocId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
void clearDocId() => clearField(1);
|
void clearDocId() => clearField(1);
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.String get data => $_getSZ(1);
|
$core.String get text => $_getSZ(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
set data($core.String v) { $_setString(1, v); }
|
set text($core.String v) {
|
||||||
|
$_setString(1, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.bool hasData() => $_has(1);
|
$core.bool hasText() => $_has(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
void clearData() => clearField(2);
|
void clearText() => clearField(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class NewDocUser extends $pb.GeneratedMessage {
|
class NewDocUser extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NewDocUser', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NewDocUser',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userId')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'userId')
|
||||||
..aInt64(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revId')
|
..aInt64(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'revId')
|
||||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
||||||
..hasRequiredFields = false
|
..hasRequiredFields = false;
|
||||||
;
|
|
||||||
|
|
||||||
NewDocUser._() : super();
|
NewDocUser._() : super();
|
||||||
factory NewDocUser({
|
factory NewDocUser({
|
||||||
|
@ -314,18 +361,19 @@ class NewDocUser extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory NewDocUser.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory NewDocUser.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
factory NewDocUser.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
create()..mergeFromBuffer(i, r);
|
||||||
@$core.Deprecated(
|
factory NewDocUser.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Using this can add significant overhead to your binary. '
|
create()..mergeFromJson(i, r);
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Will be removed in next major version')
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
|
'Will be removed in next major version')
|
||||||
NewDocUser clone() => NewDocUser()..mergeFromMessage(this);
|
NewDocUser clone() => NewDocUser()..mergeFromMessage(this);
|
||||||
@$core.Deprecated(
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Using this can add significant overhead to your binary. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Will be removed in next major version')
|
||||||
'Will be removed in next major version')
|
NewDocUser copyWith(void Function(NewDocUser) updates) =>
|
||||||
NewDocUser copyWith(void Function(NewDocUser) updates) => super.copyWith((message) => updates(message as NewDocUser)) as NewDocUser; // ignore: deprecated_member_use
|
super.copyWith((message) => updates(message as NewDocUser)) as NewDocUser; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static NewDocUser create() => NewDocUser._();
|
static NewDocUser create() => NewDocUser._();
|
||||||
|
@ -338,7 +386,10 @@ class NewDocUser extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get userId => $_getSZ(0);
|
$core.String get userId => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set userId($core.String v) { $_setString(0, v); }
|
set userId($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasUserId() => $_has(0);
|
$core.bool hasUserId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
|
@ -347,7 +398,10 @@ class NewDocUser extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$fixnum.Int64 get revId => $_getI64(1);
|
$fixnum.Int64 get revId => $_getI64(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
set revId($fixnum.Int64 v) { $_setInt64(1, v); }
|
set revId($fixnum.Int64 v) {
|
||||||
|
$_setInt64(1, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
$core.bool hasRevId() => $_has(1);
|
$core.bool hasRevId() => $_has(1);
|
||||||
@$pb.TagNumber(2)
|
@$pb.TagNumber(2)
|
||||||
|
@ -356,7 +410,10 @@ class NewDocUser extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
$core.String get docId => $_getSZ(2);
|
$core.String get docId => $_getSZ(2);
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
set docId($core.String v) { $_setString(2, v); }
|
set docId($core.String v) {
|
||||||
|
$_setString(2, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
$core.bool hasDocId() => $_has(2);
|
$core.bool hasDocId() => $_has(2);
|
||||||
@$pb.TagNumber(3)
|
@$pb.TagNumber(3)
|
||||||
|
@ -364,10 +421,11 @@ class NewDocUser extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocIdentifier extends $pb.GeneratedMessage {
|
class DocIdentifier extends $pb.GeneratedMessage {
|
||||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocIdentifier', createEmptyInstance: create)
|
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||||
|
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocIdentifier',
|
||||||
|
createEmptyInstance: create)
|
||||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
|
||||||
..hasRequiredFields = false
|
..hasRequiredFields = false;
|
||||||
;
|
|
||||||
|
|
||||||
DocIdentifier._() : super();
|
DocIdentifier._() : super();
|
||||||
factory DocIdentifier({
|
factory DocIdentifier({
|
||||||
|
@ -379,18 +437,19 @@ class DocIdentifier extends $pb.GeneratedMessage {
|
||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
factory DocIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
factory DocIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
factory DocIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
create()..mergeFromBuffer(i, r);
|
||||||
@$core.Deprecated(
|
factory DocIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||||
'Using this can add significant overhead to your binary. '
|
create()..mergeFromJson(i, r);
|
||||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Will be removed in next major version')
|
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||||
|
'Will be removed in next major version')
|
||||||
DocIdentifier clone() => DocIdentifier()..mergeFromMessage(this);
|
DocIdentifier clone() => DocIdentifier()..mergeFromMessage(this);
|
||||||
@$core.Deprecated(
|
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||||
'Using this can add significant overhead to your binary. '
|
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
'Will be removed in next major version')
|
||||||
'Will be removed in next major version')
|
DocIdentifier copyWith(void Function(DocIdentifier) updates) =>
|
||||||
DocIdentifier copyWith(void Function(DocIdentifier) updates) => super.copyWith((message) => updates(message as DocIdentifier)) as DocIdentifier; // ignore: deprecated_member_use
|
super.copyWith((message) => updates(message as DocIdentifier)) as DocIdentifier; // ignore: deprecated_member_use
|
||||||
$pb.BuilderInfo get info_ => _i;
|
$pb.BuilderInfo get info_ => _i;
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static DocIdentifier create() => DocIdentifier._();
|
static DocIdentifier create() => DocIdentifier._();
|
||||||
|
@ -403,10 +462,12 @@ class DocIdentifier extends $pb.GeneratedMessage {
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get docId => $_getSZ(0);
|
$core.String get docId => $_getSZ(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
set docId($core.String v) { $_setString(0, v); }
|
set docId($core.String v) {
|
||||||
|
$_setString(0, v);
|
||||||
|
}
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.bool hasDocId() => $_has(0);
|
$core.bool hasDocId() => $_has(0);
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
void clearDocId() => clearField(1);
|
void clearDocId() => clearField(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ const CreateDocParams$json = const {
|
||||||
|
|
||||||
/// Descriptor for `CreateDocParams`. Decode as a `google.protobuf.DescriptorProto`.
|
/// Descriptor for `CreateDocParams`. Decode as a `google.protobuf.DescriptorProto`.
|
||||||
final $typed_data.Uint8List createDocParamsDescriptor = $convert.base64Decode('Cg9DcmVhdGVEb2NQYXJhbXMSDgoCaWQYASABKAlSAmlkEi8KCXJldmlzaW9ucxgCIAEoCzIRLlJlcGVhdGVkUmV2aXNpb25SCXJldmlzaW9ucw==');
|
final $typed_data.Uint8List createDocParamsDescriptor = $convert.base64Decode('Cg9DcmVhdGVEb2NQYXJhbXMSDgoCaWQYASABKAlSAmlkEi8KCXJldmlzaW9ucxgCIAEoCzIRLlJlcGVhdGVkUmV2aXNpb25SCXJldmlzaW9ucw==');
|
||||||
@$core.Deprecated('Use docDescriptor instead')
|
@$core.Deprecated('Use documentInfoDescriptor instead')
|
||||||
const Doc$json = const {
|
const DocumentInfo$json = const {
|
||||||
'1': 'Doc',
|
'1': 'DocumentInfo',
|
||||||
'2': const [
|
'2': const [
|
||||||
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
|
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
|
||||||
const {'1': 'text', '3': 2, '4': 1, '5': 9, '10': 'text'},
|
const {'1': 'text', '3': 2, '4': 1, '5': 9, '10': 'text'},
|
||||||
|
@ -30,8 +30,8 @@ const Doc$json = const {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Descriptor for `Doc`. Decode as a `google.protobuf.DescriptorProto`.
|
/// Descriptor for `DocumentInfo`. Decode as a `google.protobuf.DescriptorProto`.
|
||||||
final $typed_data.Uint8List docDescriptor = $convert.base64Decode('CgNEb2MSDgoCaWQYASABKAlSAmlkEhIKBHRleHQYAiABKAlSBHRleHQSFQoGcmV2X2lkGAMgASgDUgVyZXZJZBIeCgtiYXNlX3Jldl9pZBgEIAEoA1IJYmFzZVJldklk');
|
final $typed_data.Uint8List documentInfoDescriptor = $convert.base64Decode('CgxEb2N1bWVudEluZm8SDgoCaWQYASABKAlSAmlkEhIKBHRleHQYAiABKAlSBHRleHQSFQoGcmV2X2lkGAMgASgDUgVyZXZJZBIeCgtiYXNlX3Jldl9pZBgEIAEoA1IJYmFzZVJldklk');
|
||||||
@$core.Deprecated('Use resetDocumentParamsDescriptor instead')
|
@$core.Deprecated('Use resetDocumentParamsDescriptor instead')
|
||||||
const ResetDocumentParams$json = const {
|
const ResetDocumentParams$json = const {
|
||||||
'1': 'ResetDocumentParams',
|
'1': 'ResetDocumentParams',
|
||||||
|
@ -43,17 +43,17 @@ const ResetDocumentParams$json = const {
|
||||||
|
|
||||||
/// Descriptor for `ResetDocumentParams`. Decode as a `google.protobuf.DescriptorProto`.
|
/// Descriptor for `ResetDocumentParams`. Decode as a `google.protobuf.DescriptorProto`.
|
||||||
final $typed_data.Uint8List resetDocumentParamsDescriptor = $convert.base64Decode('ChNSZXNldERvY3VtZW50UGFyYW1zEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQSLwoJcmV2aXNpb25zGAIgASgLMhEuUmVwZWF0ZWRSZXZpc2lvblIJcmV2aXNpb25z');
|
final $typed_data.Uint8List resetDocumentParamsDescriptor = $convert.base64Decode('ChNSZXNldERvY3VtZW50UGFyYW1zEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQSLwoJcmV2aXNpb25zGAIgASgLMhEuUmVwZWF0ZWRSZXZpc2lvblIJcmV2aXNpb25z');
|
||||||
@$core.Deprecated('Use docDeltaDescriptor instead')
|
@$core.Deprecated('Use documentDeltaDescriptor instead')
|
||||||
const DocDelta$json = const {
|
const DocumentDelta$json = const {
|
||||||
'1': 'DocDelta',
|
'1': 'DocumentDelta',
|
||||||
'2': const [
|
'2': const [
|
||||||
const {'1': 'doc_id', '3': 1, '4': 1, '5': 9, '10': 'docId'},
|
const {'1': 'doc_id', '3': 1, '4': 1, '5': 9, '10': 'docId'},
|
||||||
const {'1': 'data', '3': 2, '4': 1, '5': 9, '10': 'data'},
|
const {'1': 'text', '3': 2, '4': 1, '5': 9, '10': 'text'},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Descriptor for `DocDelta`. Decode as a `google.protobuf.DescriptorProto`.
|
/// Descriptor for `DocumentDelta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||||
final $typed_data.Uint8List docDeltaDescriptor = $convert.base64Decode('CghEb2NEZWx0YRIVCgZkb2NfaWQYASABKAlSBWRvY0lkEhIKBGRhdGEYAiABKAlSBGRhdGE=');
|
final $typed_data.Uint8List documentDeltaDescriptor = $convert.base64Decode('Cg1Eb2N1bWVudERlbHRhEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQSEgoEdGV4dBgCIAEoCVIEdGV4dA==');
|
||||||
@$core.Deprecated('Use newDocUserDescriptor instead')
|
@$core.Deprecated('Use newDocUserDescriptor instead')
|
||||||
const NewDocUser$json = const {
|
const NewDocUser$json = const {
|
||||||
'1': 'NewDocUser',
|
'1': 'NewDocUser',
|
||||||
|
|
|
@ -4,7 +4,7 @@ use chrono::Utc;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use flowy_collaboration::{core::document::default::initial_read_me, entities::doc::DocDelta};
|
use flowy_collaboration::{core::document::default::initial_read_me, entities::doc::DocumentDelta};
|
||||||
use flowy_core_data_model::user_default;
|
use flowy_core_data_model::user_default;
|
||||||
use flowy_net::entities::NetworkType;
|
use flowy_net::entities::NetworkType;
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ impl CoreContext {
|
||||||
for (index, view) in views.into_iter().enumerate() {
|
for (index, view) in views.into_iter().enumerate() {
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
let delta = initial_read_me();
|
let delta = initial_read_me();
|
||||||
let doc_delta = DocDelta {
|
let doc_delta = DocumentDelta {
|
||||||
doc_id: view.id.clone(),
|
doc_id: view.id.clone(),
|
||||||
data: delta.to_json(),
|
text: delta.to_json(),
|
||||||
};
|
};
|
||||||
let _ = self.view_controller.apply_doc_delta(doc_delta).await?;
|
let _ = self.view_controller.apply_doc_delta(doc_delta).await?;
|
||||||
self.view_controller.set_latest_view(&view);
|
self.view_controller.set_latest_view(&view);
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub enum WorkspaceEvent {
|
||||||
#[event()]
|
#[event()]
|
||||||
CopyLink = 206,
|
CopyLink = 206,
|
||||||
|
|
||||||
#[event(input = "QueryViewRequest", output = "DocDelta")]
|
#[event(input = "QueryViewRequest", output = "DocumentDelta")]
|
||||||
OpenView = 207,
|
OpenView = 207,
|
||||||
|
|
||||||
#[event(input = "QueryViewRequest")]
|
#[event(input = "QueryViewRequest")]
|
||||||
|
@ -73,7 +73,7 @@ pub enum WorkspaceEvent {
|
||||||
#[event()]
|
#[event()]
|
||||||
DeleteAll = 304,
|
DeleteAll = 304,
|
||||||
|
|
||||||
#[event(input = "DocDelta", output = "DocDelta")]
|
#[event(input = "DocumentDelta", output = "DocumentDelta")]
|
||||||
ApplyDocDelta = 400,
|
ApplyDocDelta = 400,
|
||||||
|
|
||||||
#[event(input = "ExportRequest", output = "ExportData")]
|
#[event(input = "ExportRequest", output = "ExportData")]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use flowy_collaboration::entities::doc::{DocDelta, DocIdentifier};
|
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta};
|
||||||
use flowy_database::SqliteConnection;
|
use flowy_database::SqliteConnection;
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use std::{collections::HashSet, sync::Arc};
|
use std::{collections::HashSet, sync::Arc};
|
||||||
|
@ -110,7 +110,7 @@ impl ViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "debug", skip(self, params), fields(doc_id = %params.doc_id), err)]
|
#[tracing::instrument(level = "debug", skip(self, params), fields(doc_id = %params.doc_id), err)]
|
||||||
pub(crate) async fn open_view(&self, params: DocIdentifier) -> Result<DocDelta, FlowyError> {
|
pub(crate) async fn open_view(&self, params: DocIdentifier) -> Result<DocumentDelta, FlowyError> {
|
||||||
let doc_id = params.doc_id.clone();
|
let doc_id = params.doc_id.clone();
|
||||||
let edit_context = self.document.open(params).await?;
|
let edit_context = self.document.open(params).await?;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ impl ViewController {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(ExportData {
|
Ok(ExportData {
|
||||||
data: doc.data,
|
data: doc.text,
|
||||||
export_type: params.export_type,
|
export_type: params.export_type,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ impl ViewController {
|
||||||
Ok(updated_view)
|
Ok(updated_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn apply_doc_delta(&self, params: DocDelta) -> Result<DocDelta, FlowyError> {
|
pub(crate) async fn apply_doc_delta(&self, params: DocumentDelta) -> Result<DocumentDelta, FlowyError> {
|
||||||
let doc = self.document.apply_doc_delta(params).await?;
|
let doc = self.document.apply_doc_delta(params).await?;
|
||||||
Ok(doc)
|
Ok(doc)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
errors::FlowyError,
|
errors::FlowyError,
|
||||||
services::{TrashController, ViewController},
|
services::{TrashController, ViewController},
|
||||||
};
|
};
|
||||||
use flowy_collaboration::entities::doc::DocDelta;
|
use flowy_collaboration::entities::doc::DocumentDelta;
|
||||||
use flowy_core_data_model::entities::share::{ExportData, ExportParams, ExportRequest};
|
use flowy_core_data_model::entities::share::{ExportData, ExportParams, ExportRequest};
|
||||||
use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
||||||
use std::{convert::TryInto, sync::Arc};
|
use std::{convert::TryInto, sync::Arc};
|
||||||
|
@ -52,10 +52,10 @@ pub(crate) async fn update_view_handler(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn apply_doc_delta_handler(
|
pub(crate) async fn apply_doc_delta_handler(
|
||||||
data: Data<DocDelta>,
|
data: Data<DocumentDelta>,
|
||||||
controller: Unit<Arc<ViewController>>,
|
controller: Unit<Arc<ViewController>>,
|
||||||
) -> DataResult<DocDelta, FlowyError> {
|
) -> DataResult<DocumentDelta, FlowyError> {
|
||||||
// let params: DocDelta = data.into_inner().try_into()?;
|
// let params: DocumentDelta = data.into_inner().try_into()?;
|
||||||
let doc = controller.apply_doc_delta(data.into_inner()).await?;
|
let doc = controller.apply_doc_delta(data.into_inner()).await?;
|
||||||
data_result(doc)
|
data_result(doc)
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ pub(crate) async fn delete_view_handler(
|
||||||
pub(crate) async fn open_view_handler(
|
pub(crate) async fn open_view_handler(
|
||||||
data: Data<QueryViewRequest>,
|
data: Data<QueryViewRequest>,
|
||||||
controller: Unit<Arc<ViewController>>,
|
controller: Unit<Arc<ViewController>>,
|
||||||
) -> DataResult<DocDelta, FlowyError> {
|
) -> DataResult<DocumentDelta, FlowyError> {
|
||||||
let params: ViewIdentifier = data.into_inner().try_into()?;
|
let params: ViewIdentifier = data.into_inner().try_into()?;
|
||||||
let doc = controller.open_view(params.into()).await?;
|
let doc = controller.open_view(params.into()).await?;
|
||||||
data_result(doc)
|
data_result(doc)
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use backend_service::configuration::ClientServerConfiguration;
|
use backend_service::configuration::ClientServerConfiguration;
|
||||||
use flowy_collaboration::entities::doc::{DocDelta, DocIdentifier};
|
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta};
|
||||||
use flowy_database::ConnectionPool;
|
use flowy_database::ConnectionPool;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -58,13 +58,13 @@ impl FlowyDocument {
|
||||||
&self,
|
&self,
|
||||||
params: DocIdentifier,
|
params: DocIdentifier,
|
||||||
pool: Arc<ConnectionPool>,
|
pool: Arc<ConnectionPool>,
|
||||||
) -> Result<DocDelta, FlowyError> {
|
) -> Result<DocumentDelta, FlowyError> {
|
||||||
let edit_context = self.doc_ctrl.open(params, pool).await?;
|
let edit_context = self.doc_ctrl.open(params, pool).await?;
|
||||||
let delta = edit_context.delta().await?;
|
let delta = edit_context.delta().await?;
|
||||||
Ok(delta)
|
Ok(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn apply_doc_delta(&self, params: DocDelta) -> Result<DocDelta, FlowyError> {
|
pub async fn apply_doc_delta(&self, params: DocumentDelta) -> Result<DocumentDelta, FlowyError> {
|
||||||
// workaround: compare the rust's delta with flutter's delta. Will be removed
|
// workaround: compare the rust's delta with flutter's delta. Will be removed
|
||||||
// very soon
|
// very soon
|
||||||
let doc = self
|
let doc = self
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use flowy_collaboration::entities::doc::{Doc, DocDelta, DocIdentifier};
|
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta, DocumentInfo};
|
||||||
use flowy_database::ConnectionPool;
|
use flowy_database::ConnectionPool;
|
||||||
use flowy_error::FlowyResult;
|
use flowy_error::FlowyResult;
|
||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
|
@ -77,16 +77,16 @@ impl DocController {
|
||||||
#[tracing::instrument(level = "debug", skip(self, delta, db_pool), fields(doc_id = %delta.doc_id), err)]
|
#[tracing::instrument(level = "debug", skip(self, delta, db_pool), fields(doc_id = %delta.doc_id), err)]
|
||||||
pub(crate) async fn apply_local_delta(
|
pub(crate) async fn apply_local_delta(
|
||||||
&self,
|
&self,
|
||||||
delta: DocDelta,
|
delta: DocumentDelta,
|
||||||
db_pool: Arc<ConnectionPool>,
|
db_pool: Arc<ConnectionPool>,
|
||||||
) -> Result<DocDelta, FlowyError> {
|
) -> Result<DocumentDelta, FlowyError> {
|
||||||
if !self.open_cache.contains(&delta.doc_id) {
|
if !self.open_cache.contains(&delta.doc_id) {
|
||||||
let doc_identifier: DocIdentifier = delta.doc_id.clone().into();
|
let doc_identifier: DocIdentifier = delta.doc_id.clone().into();
|
||||||
let _ = self.open(doc_identifier, db_pool).await?;
|
let _ = self.open(doc_identifier, db_pool).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let edit_doc_ctx = self.open_cache.get(&delta.doc_id)?;
|
let edit_doc_ctx = self.open_cache.get(&delta.doc_id)?;
|
||||||
let _ = edit_doc_ctx.composing_local_delta(Bytes::from(delta.data)).await?;
|
let _ = edit_doc_ctx.composing_local_delta(Bytes::from(delta.text)).await?;
|
||||||
Ok(edit_doc_ctx.delta().await?)
|
Ok(edit_doc_ctx.delta().await?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ struct RevisionServerImpl {
|
||||||
|
|
||||||
impl RevisionServer for RevisionServerImpl {
|
impl RevisionServer for RevisionServerImpl {
|
||||||
#[tracing::instrument(level = "debug", skip(self))]
|
#[tracing::instrument(level = "debug", skip(self))]
|
||||||
fn fetch_document(&self, doc_id: &str) -> FutureResult<Doc, FlowyError> {
|
fn fetch_document(&self, doc_id: &str) -> FutureResult<DocumentInfo, FlowyError> {
|
||||||
let params = DocIdentifier {
|
let params = DocIdentifier {
|
||||||
doc_id: doc_id.to_string(),
|
doc_id: doc_id.to_string(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ use bytes::Bytes;
|
||||||
use flowy_collaboration::{
|
use flowy_collaboration::{
|
||||||
core::document::history::UndoResult,
|
core::document::history::UndoResult,
|
||||||
entities::{
|
entities::{
|
||||||
doc::DocDelta,
|
doc::DocumentDelta,
|
||||||
revision::{RevId, RevType, Revision},
|
revision::{RevId, RevType, Revision},
|
||||||
},
|
},
|
||||||
errors::CollaborateResult,
|
errors::CollaborateResult,
|
||||||
|
@ -144,15 +144,15 @@ impl ClientDocEditor {
|
||||||
Ok(r)
|
Ok(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delta(&self) -> FlowyResult<DocDelta> {
|
pub async fn delta(&self) -> FlowyResult<DocumentDelta> {
|
||||||
let (ret, rx) = oneshot::channel::<CollaborateResult<DocumentMD5>>();
|
let (ret, rx) = oneshot::channel::<CollaborateResult<DocumentMD5>>();
|
||||||
let msg = EditorCommand::ReadDoc { ret };
|
let msg = EditorCommand::ReadDoc { ret };
|
||||||
let _ = self.editor_cmd_sender.send(msg);
|
let _ = self.editor_cmd_sender.send(msg);
|
||||||
let data = rx.await.map_err(internal_error)??;
|
let data = rx.await.map_err(internal_error)??;
|
||||||
|
|
||||||
Ok(DocDelta {
|
Ok(DocumentDelta {
|
||||||
doc_id: self.doc_id.clone(),
|
doc_id: self.doc_id.clone(),
|
||||||
data,
|
text: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{errors::FlowyError, services::doc::revision::RevisionCache};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use flowy_collaboration::{
|
use flowy_collaboration::{
|
||||||
entities::{
|
entities::{
|
||||||
doc::Doc,
|
doc::DocumentInfo,
|
||||||
revision::{RevState, RevType, Revision, RevisionRange},
|
revision::{RevState, RevType, Revision, RevisionRange},
|
||||||
},
|
},
|
||||||
util::{md5, RevIdCounter},
|
util::{md5, RevIdCounter},
|
||||||
|
@ -16,7 +16,7 @@ use lib_ot::{
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub trait RevisionServer: Send + Sync {
|
pub trait RevisionServer: Send + Sync {
|
||||||
fn fetch_document(&self, doc_id: &str) -> FutureResult<Doc, FlowyError>;
|
fn fetch_document(&self, doc_id: &str) -> FutureResult<DocumentInfo, FlowyError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RevisionManager {
|
pub struct RevisionManager {
|
||||||
|
@ -158,7 +158,7 @@ impl RevisionLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mk_doc_from_revisions(doc_id: &str, revisions: Vec<Revision>) -> FlowyResult<Doc> {
|
fn mk_doc_from_revisions(doc_id: &str, revisions: Vec<Revision>) -> FlowyResult<DocumentInfo> {
|
||||||
let (base_rev_id, rev_id) = revisions.last().unwrap().pair_rev_id();
|
let (base_rev_id, rev_id) = revisions.last().unwrap().pair_rev_id();
|
||||||
let mut delta = RichTextDelta::new();
|
let mut delta = RichTextDelta::new();
|
||||||
for (_, revision) in revisions.into_iter().enumerate() {
|
for (_, revision) in revisions.into_iter().enumerate() {
|
||||||
|
@ -173,7 +173,7 @@ fn mk_doc_from_revisions(doc_id: &str, revisions: Vec<Revision>) -> FlowyResult<
|
||||||
}
|
}
|
||||||
correct_delta_if_need(&mut delta);
|
correct_delta_if_need(&mut delta);
|
||||||
|
|
||||||
Result::<Doc, FlowyError>::Ok(Doc {
|
Result::<DocumentInfo, FlowyError>::Ok(DocumentInfo {
|
||||||
id: doc_id.to_owned(),
|
id: doc_id.to_owned(),
|
||||||
text: delta.to_json(),
|
text: delta.to_json(),
|
||||||
rev_id,
|
rev_id,
|
||||||
|
|
|
@ -6,7 +6,7 @@ pub use server_api::*;
|
||||||
// TODO: ignore mock files in production
|
// TODO: ignore mock files in production
|
||||||
use crate::errors::FlowyError;
|
use crate::errors::FlowyError;
|
||||||
use backend_service::configuration::ClientServerConfiguration;
|
use backend_service::configuration::ClientServerConfiguration;
|
||||||
use flowy_collaboration::entities::doc::{CreateDocParams, Doc, DocIdentifier, ResetDocumentParams};
|
use flowy_collaboration::entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams};
|
||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
pub use server_api_mock::*;
|
pub use server_api_mock::*;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -15,7 +15,7 @@ pub(crate) type Server = Arc<dyn DocumentServerAPI + Send + Sync>;
|
||||||
pub trait DocumentServerAPI {
|
pub trait DocumentServerAPI {
|
||||||
fn create_doc(&self, token: &str, params: CreateDocParams) -> FutureResult<(), FlowyError>;
|
fn create_doc(&self, token: &str, params: CreateDocParams) -> FutureResult<(), FlowyError>;
|
||||||
|
|
||||||
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<Doc>, FlowyError>;
|
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError>;
|
||||||
|
|
||||||
fn update_doc(&self, token: &str, params: ResetDocumentParams) -> FutureResult<(), FlowyError>;
|
fn update_doc(&self, token: &str, params: ResetDocumentParams) -> FutureResult<(), FlowyError>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{errors::FlowyError, services::server::DocumentServerAPI};
|
use crate::{errors::FlowyError, services::server::DocumentServerAPI};
|
||||||
use backend_service::{configuration::*, request::HttpRequestBuilder};
|
use backend_service::{configuration::*, request::HttpRequestBuilder};
|
||||||
use flowy_collaboration::entities::doc::{CreateDocParams, Doc, DocIdentifier, ResetDocumentParams};
|
use flowy_collaboration::entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams};
|
||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
|
|
||||||
pub struct DocServer {
|
pub struct DocServer {
|
||||||
|
@ -18,7 +18,7 @@ impl DocumentServerAPI for DocServer {
|
||||||
FutureResult::new(async move { create_doc_request(&token, params, &url).await })
|
FutureResult::new(async move { create_doc_request(&token, params, &url).await })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<Doc>, FlowyError> {
|
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError> {
|
||||||
let token = token.to_owned();
|
let token = token.to_owned();
|
||||||
let url = self.config.doc_url();
|
let url = self.config.doc_url();
|
||||||
FutureResult::new(async move { read_doc_request(&token, params, &url).await })
|
FutureResult::new(async move { read_doc_request(&token, params, &url).await })
|
||||||
|
@ -45,7 +45,11 @@ pub async fn create_doc_request(token: &str, params: CreateDocParams, url: &str)
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn read_doc_request(token: &str, params: DocIdentifier, url: &str) -> Result<Option<Doc>, FlowyError> {
|
pub async fn read_doc_request(
|
||||||
|
token: &str,
|
||||||
|
params: DocIdentifier,
|
||||||
|
url: &str,
|
||||||
|
) -> Result<Option<DocumentInfo>, FlowyError> {
|
||||||
let doc = request_builder()
|
let doc = request_builder()
|
||||||
.get(&url.to_owned())
|
.get(&url.to_owned())
|
||||||
.header(HEADER_TOKEN, token)
|
.header(HEADER_TOKEN, token)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use flowy_collaboration::{
|
use flowy_collaboration::{
|
||||||
core::document::default::initial_delta_string,
|
core::document::default::initial_delta_string,
|
||||||
entities::doc::{CreateDocParams, Doc, DocIdentifier, ResetDocumentParams},
|
entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams},
|
||||||
};
|
};
|
||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ impl DocumentServerAPI for DocServerMock {
|
||||||
FutureResult::new(async { Ok(()) })
|
FutureResult::new(async { Ok(()) })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_doc(&self, _token: &str, params: DocIdentifier) -> FutureResult<Option<Doc>, FlowyError> {
|
fn read_doc(&self, _token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError> {
|
||||||
let doc = Doc {
|
let doc = DocumentInfo {
|
||||||
id: params.doc_id,
|
id: params.doc_id,
|
||||||
text: initial_delta_string(),
|
text: initial_delta_string(),
|
||||||
rev_id: 0,
|
rev_id: 0,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use dashmap::DashMap;
|
||||||
use flowy_collaboration::{
|
use flowy_collaboration::{
|
||||||
core::sync::{DocumentPersistence, RevisionUser, ServerDocumentManager, SyncResponse},
|
core::sync::{DocumentPersistence, RevisionUser, ServerDocumentManager, SyncResponse},
|
||||||
entities::{
|
entities::{
|
||||||
doc::Doc,
|
doc::DocumentInfo,
|
||||||
revision::Revision,
|
revision::Revision,
|
||||||
ws::{DocumentWSData, DocumentWSDataBuilder, DocumentWSDataType, NewDocumentUser},
|
ws::{DocumentWSData, DocumentWSDataBuilder, DocumentWSDataType, NewDocumentUser},
|
||||||
},
|
},
|
||||||
|
@ -148,7 +148,7 @@ impl MockDocServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MockDocServerPersistence {
|
struct MockDocServerPersistence {
|
||||||
inner: Arc<DashMap<String, Doc>>,
|
inner: Arc<DashMap<String, DocumentInfo>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for MockDocServerPersistence {
|
impl std::default::Default for MockDocServerPersistence {
|
||||||
|
@ -160,11 +160,7 @@ impl std::default::Default for MockDocServerPersistence {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DocumentPersistence for MockDocServerPersistence {
|
impl DocumentPersistence for MockDocServerPersistence {
|
||||||
// fn update_doc(&self, _doc_id: &str, _rev_id: i64, _delta: RichTextDelta) ->
|
fn read_doc(&self, doc_id: &str) -> FutureResultSend<DocumentInfo, CollaborateError> {
|
||||||
// FutureResultSend<(), CollaborateError> { unimplemented!()
|
|
||||||
// }
|
|
||||||
|
|
||||||
fn read_doc(&self, doc_id: &str) -> FutureResultSend<Doc, CollaborateError> {
|
|
||||||
let inner = self.inner.clone();
|
let inner = self.inner.clone();
|
||||||
let doc_id = doc_id.to_owned();
|
let doc_id = doc_id.to_owned();
|
||||||
FutureResultSend::new(async move {
|
FutureResultSend::new(async move {
|
||||||
|
@ -181,10 +177,10 @@ impl DocumentPersistence for MockDocServerPersistence {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_doc(&self, revision: Revision) -> FutureResultSend<Doc, CollaborateError> {
|
fn create_doc(&self, revision: Revision) -> FutureResultSend<DocumentInfo, CollaborateError> {
|
||||||
FutureResultSend::new(async move {
|
FutureResultSend::new(async move {
|
||||||
let doc: Doc = revision.try_into().unwrap();
|
let document_info: DocumentInfo = revision.try_into().unwrap();
|
||||||
Ok(doc)
|
Ok(document_info)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{fs, path::PathBuf, sync::Arc};
|
use std::{fs, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
use flowy_collaboration::entities::doc::Doc;
|
use flowy_collaboration::entities::doc::DocumentInfo;
|
||||||
use flowy_core::{
|
use flowy_core::{
|
||||||
entities::{
|
entities::{
|
||||||
app::*,
|
app::*,
|
||||||
|
@ -269,13 +269,13 @@ pub async fn putback_trash(sdk: &FlowySDKTest, id: TrashIdentifier) {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn open_view(sdk: &FlowySDKTest, request: QueryViewRequest) -> Doc {
|
pub async fn open_view(sdk: &FlowySDKTest, request: QueryViewRequest) -> DocumentInfo {
|
||||||
CoreModuleEventBuilder::new(sdk.clone())
|
CoreModuleEventBuilder::new(sdk.clone())
|
||||||
.event(OpenView)
|
.event(OpenView)
|
||||||
.request(request)
|
.request(request)
|
||||||
.async_send()
|
.async_send()
|
||||||
.await
|
.await
|
||||||
.parse::<Doc>()
|
.parse::<DocumentInfo>()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn root_dir() -> String {
|
pub fn root_dir() -> String {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
||||||
document::Document,
|
document::Document,
|
||||||
sync::{RevisionSynchronizer, RevisionUser},
|
sync::{RevisionSynchronizer, RevisionUser},
|
||||||
},
|
},
|
||||||
entities::{doc::Doc, revision::Revision},
|
entities::{doc::DocumentInfo, revision::Revision},
|
||||||
errors::{internal_error, CollaborateError, CollaborateResult},
|
errors::{internal_error, CollaborateError, CollaborateResult},
|
||||||
};
|
};
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
|
@ -20,8 +20,8 @@ use tokio::{
|
||||||
pub trait DocumentPersistence: Send + Sync {
|
pub trait DocumentPersistence: Send + Sync {
|
||||||
// fn update_doc(&self, doc_id: &str, rev_id: i64, delta: RichTextDelta) ->
|
// fn update_doc(&self, doc_id: &str, rev_id: i64, delta: RichTextDelta) ->
|
||||||
// FutureResultSend<(), CollaborateError>;
|
// FutureResultSend<(), CollaborateError>;
|
||||||
fn read_doc(&self, doc_id: &str) -> FutureResultSend<Doc, CollaborateError>;
|
fn read_doc(&self, doc_id: &str) -> FutureResultSend<DocumentInfo, CollaborateError>;
|
||||||
fn create_doc(&self, revision: Revision) -> FutureResultSend<Doc, CollaborateError>;
|
fn create_doc(&self, revision: Revision) -> FutureResultSend<DocumentInfo, CollaborateError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ServerDocumentManager {
|
pub struct ServerDocumentManager {
|
||||||
|
@ -63,7 +63,7 @@ impl ServerDocumentManager {
|
||||||
Ok(handler)
|
Ok(handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn cache(&self, doc: Doc) -> Result<Arc<OpenDocHandle>, CollaborateError> {
|
async fn cache(&self, doc: DocumentInfo) -> Result<Arc<OpenDocHandle>, CollaborateError> {
|
||||||
let doc_id = doc.id.clone();
|
let doc_id = doc.id.clone();
|
||||||
let handle = spawn_blocking(|| OpenDocHandle::new(doc))
|
let handle = spawn_blocking(|| OpenDocHandle::new(doc))
|
||||||
.await
|
.await
|
||||||
|
@ -79,7 +79,7 @@ pub struct OpenDocHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OpenDocHandle {
|
impl OpenDocHandle {
|
||||||
pub fn new(doc: Doc) -> Result<Self, CollaborateError> {
|
pub fn new(doc: DocumentInfo) -> Result<Self, CollaborateError> {
|
||||||
let (sender, receiver) = mpsc::channel(100);
|
let (sender, receiver) = mpsc::channel(100);
|
||||||
let queue = DocCommandQueue::new(receiver, doc)?;
|
let queue = DocCommandQueue::new(receiver, doc)?;
|
||||||
tokio::task::spawn(queue.run());
|
tokio::task::spawn(queue.run());
|
||||||
|
@ -137,7 +137,7 @@ struct DocCommandQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DocCommandQueue {
|
impl DocCommandQueue {
|
||||||
fn new(receiver: mpsc::Receiver<DocCommand>, doc: Doc) -> Result<Self, CollaborateError> {
|
fn new(receiver: mpsc::Receiver<DocCommand>, doc: DocumentInfo) -> Result<Self, CollaborateError> {
|
||||||
let edit_doc = Arc::new(ServerDocEditor::new(doc).map_err(internal_error)?);
|
let edit_doc = Arc::new(ServerDocEditor::new(doc).map_err(internal_error)?);
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
receiver: Some(receiver),
|
receiver: Some(receiver),
|
||||||
|
@ -205,7 +205,7 @@ pub struct ServerDocEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerDocEditor {
|
impl ServerDocEditor {
|
||||||
pub fn new(doc: Doc) -> Result<Self, OTError> {
|
pub fn new(doc: DocumentInfo) -> Result<Self, OTError> {
|
||||||
let delta = RichTextDelta::from_bytes(&doc.text)?;
|
let delta = RichTextDelta::from_bytes(&doc.text)?;
|
||||||
let users = DashMap::new();
|
let users = DashMap::new();
|
||||||
let synchronizer = Arc::new(RevisionSynchronizer::new(
|
let synchronizer = Arc::new(RevisionSynchronizer::new(
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub struct CreateDocParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ProtoBuf, Default, Debug, Clone, Eq, PartialEq)]
|
#[derive(ProtoBuf, Default, Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct Doc {
|
pub struct DocumentInfo {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@ pub struct Doc {
|
||||||
pub base_rev_id: i64,
|
pub base_rev_id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Doc {
|
impl DocumentInfo {
|
||||||
pub fn delta(&self) -> Result<RichTextDelta, OTError> {
|
pub fn delta(&self) -> Result<RichTextDelta, OTError> {
|
||||||
let delta = RichTextDelta::from_bytes(&self.text)?;
|
let delta = RichTextDelta::from_bytes(&self.text)?;
|
||||||
Ok(delta)
|
Ok(delta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::convert::TryFrom<Revision> for Doc {
|
impl std::convert::TryFrom<Revision> for DocumentInfo {
|
||||||
type Error = CollaborateError;
|
type Error = CollaborateError;
|
||||||
|
|
||||||
fn try_from(revision: Revision) -> Result<Self, Self::Error> {
|
fn try_from(revision: Revision) -> Result<Self, Self::Error> {
|
||||||
|
@ -48,7 +48,7 @@ impl std::convert::TryFrom<Revision> for Doc {
|
||||||
let delta = RichTextDelta::from_bytes(&revision.delta_data)?;
|
let delta = RichTextDelta::from_bytes(&revision.delta_data)?;
|
||||||
let doc_json = delta.to_json();
|
let doc_json = delta.to_json();
|
||||||
|
|
||||||
Ok(Doc {
|
Ok(DocumentInfo {
|
||||||
id: revision.doc_id,
|
id: revision.doc_id,
|
||||||
text: doc_json,
|
text: doc_json,
|
||||||
rev_id: revision.rev_id,
|
rev_id: revision.rev_id,
|
||||||
|
@ -67,12 +67,12 @@ pub struct ResetDocumentParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ProtoBuf, Default, Debug, Clone)]
|
#[derive(ProtoBuf, Default, Debug, Clone)]
|
||||||
pub struct DocDelta {
|
pub struct DocumentDelta {
|
||||||
#[pb(index = 1)]
|
#[pb(index = 1)]
|
||||||
pub doc_id: String,
|
pub doc_id: String,
|
||||||
|
|
||||||
#[pb(index = 2)]
|
#[pb(index = 2)]
|
||||||
pub data: String, // RichTextDelta
|
pub text: String, // RichTextDelta
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ProtoBuf, Default, Debug, Clone)]
|
#[derive(ProtoBuf, Default, Debug, Clone)]
|
||||||
|
|
|
@ -240,7 +240,7 @@ impl ::protobuf::reflect::ProtobufValue for CreateDocParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq,Clone,Default)]
|
#[derive(PartialEq,Clone,Default)]
|
||||||
pub struct Doc {
|
pub struct DocumentInfo {
|
||||||
// message fields
|
// message fields
|
||||||
pub id: ::std::string::String,
|
pub id: ::std::string::String,
|
||||||
pub text: ::std::string::String,
|
pub text: ::std::string::String,
|
||||||
|
@ -251,14 +251,14 @@ pub struct Doc {
|
||||||
pub cached_size: ::protobuf::CachedSize,
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ::std::default::Default for &'a Doc {
|
impl<'a> ::std::default::Default for &'a DocumentInfo {
|
||||||
fn default() -> &'a Doc {
|
fn default() -> &'a DocumentInfo {
|
||||||
<Doc as ::protobuf::Message>::default_instance()
|
<DocumentInfo as ::protobuf::Message>::default_instance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Doc {
|
impl DocumentInfo {
|
||||||
pub fn new() -> Doc {
|
pub fn new() -> DocumentInfo {
|
||||||
::std::default::Default::default()
|
::std::default::Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ impl Doc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::Message for Doc {
|
impl ::protobuf::Message for DocumentInfo {
|
||||||
fn is_initialized(&self) -> bool {
|
fn is_initialized(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -446,8 +446,8 @@ impl ::protobuf::Message for Doc {
|
||||||
Self::descriptor_static()
|
Self::descriptor_static()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new() -> Doc {
|
fn new() -> DocumentInfo {
|
||||||
Doc::new()
|
DocumentInfo::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
@ -456,39 +456,39 @@ impl ::protobuf::Message for Doc {
|
||||||
let mut fields = ::std::vec::Vec::new();
|
let mut fields = ::std::vec::Vec::new();
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
"id",
|
"id",
|
||||||
|m: &Doc| { &m.id },
|
|m: &DocumentInfo| { &m.id },
|
||||||
|m: &mut Doc| { &mut m.id },
|
|m: &mut DocumentInfo| { &mut m.id },
|
||||||
));
|
));
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
"text",
|
"text",
|
||||||
|m: &Doc| { &m.text },
|
|m: &DocumentInfo| { &m.text },
|
||||||
|m: &mut Doc| { &mut m.text },
|
|m: &mut DocumentInfo| { &mut m.text },
|
||||||
));
|
));
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
|
||||||
"rev_id",
|
"rev_id",
|
||||||
|m: &Doc| { &m.rev_id },
|
|m: &DocumentInfo| { &m.rev_id },
|
||||||
|m: &mut Doc| { &mut m.rev_id },
|
|m: &mut DocumentInfo| { &mut m.rev_id },
|
||||||
));
|
));
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
|
||||||
"base_rev_id",
|
"base_rev_id",
|
||||||
|m: &Doc| { &m.base_rev_id },
|
|m: &DocumentInfo| { &m.base_rev_id },
|
||||||
|m: &mut Doc| { &mut m.base_rev_id },
|
|m: &mut DocumentInfo| { &mut m.base_rev_id },
|
||||||
));
|
));
|
||||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<Doc>(
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocumentInfo>(
|
||||||
"Doc",
|
"DocumentInfo",
|
||||||
fields,
|
fields,
|
||||||
file_descriptor_proto()
|
file_descriptor_proto()
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_instance() -> &'static Doc {
|
fn default_instance() -> &'static DocumentInfo {
|
||||||
static instance: ::protobuf::rt::LazyV2<Doc> = ::protobuf::rt::LazyV2::INIT;
|
static instance: ::protobuf::rt::LazyV2<DocumentInfo> = ::protobuf::rt::LazyV2::INIT;
|
||||||
instance.get(Doc::new)
|
instance.get(DocumentInfo::new)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::Clear for Doc {
|
impl ::protobuf::Clear for DocumentInfo {
|
||||||
fn clear(&mut self) {
|
fn clear(&mut self) {
|
||||||
self.id.clear();
|
self.id.clear();
|
||||||
self.text.clear();
|
self.text.clear();
|
||||||
|
@ -498,13 +498,13 @@ impl ::protobuf::Clear for Doc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Debug for Doc {
|
impl ::std::fmt::Debug for DocumentInfo {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
::protobuf::text_format::fmt(self, f)
|
::protobuf::text_format::fmt(self, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::reflect::ProtobufValue for Doc {
|
impl ::protobuf::reflect::ProtobufValue for DocumentInfo {
|
||||||
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
::protobuf::reflect::ReflectValueRef::Message(self)
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
}
|
}
|
||||||
|
@ -727,23 +727,23 @@ impl ::protobuf::reflect::ProtobufValue for ResetDocumentParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq,Clone,Default)]
|
#[derive(PartialEq,Clone,Default)]
|
||||||
pub struct DocDelta {
|
pub struct DocumentDelta {
|
||||||
// message fields
|
// message fields
|
||||||
pub doc_id: ::std::string::String,
|
pub doc_id: ::std::string::String,
|
||||||
pub data: ::std::string::String,
|
pub text: ::std::string::String,
|
||||||
// special fields
|
// special fields
|
||||||
pub unknown_fields: ::protobuf::UnknownFields,
|
pub unknown_fields: ::protobuf::UnknownFields,
|
||||||
pub cached_size: ::protobuf::CachedSize,
|
pub cached_size: ::protobuf::CachedSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ::std::default::Default for &'a DocDelta {
|
impl<'a> ::std::default::Default for &'a DocumentDelta {
|
||||||
fn default() -> &'a DocDelta {
|
fn default() -> &'a DocumentDelta {
|
||||||
<DocDelta as ::protobuf::Message>::default_instance()
|
<DocumentDelta as ::protobuf::Message>::default_instance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DocDelta {
|
impl DocumentDelta {
|
||||||
pub fn new() -> DocDelta {
|
pub fn new() -> DocumentDelta {
|
||||||
::std::default::Default::default()
|
::std::default::Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,34 +773,34 @@ impl DocDelta {
|
||||||
::std::mem::replace(&mut self.doc_id, ::std::string::String::new())
|
::std::mem::replace(&mut self.doc_id, ::std::string::String::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
// string data = 2;
|
// string text = 2;
|
||||||
|
|
||||||
|
|
||||||
pub fn get_data(&self) -> &str {
|
pub fn get_text(&self) -> &str {
|
||||||
&self.data
|
&self.text
|
||||||
}
|
}
|
||||||
pub fn clear_data(&mut self) {
|
pub fn clear_text(&mut self) {
|
||||||
self.data.clear();
|
self.text.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Param is passed by value, moved
|
// Param is passed by value, moved
|
||||||
pub fn set_data(&mut self, v: ::std::string::String) {
|
pub fn set_text(&mut self, v: ::std::string::String) {
|
||||||
self.data = v;
|
self.text = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutable pointer to the field.
|
// Mutable pointer to the field.
|
||||||
// If field is not initialized, it is initialized with default value first.
|
// If field is not initialized, it is initialized with default value first.
|
||||||
pub fn mut_data(&mut self) -> &mut ::std::string::String {
|
pub fn mut_text(&mut self) -> &mut ::std::string::String {
|
||||||
&mut self.data
|
&mut self.text
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take field
|
// Take field
|
||||||
pub fn take_data(&mut self) -> ::std::string::String {
|
pub fn take_text(&mut self) -> ::std::string::String {
|
||||||
::std::mem::replace(&mut self.data, ::std::string::String::new())
|
::std::mem::replace(&mut self.text, ::std::string::String::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::Message for DocDelta {
|
impl ::protobuf::Message for DocumentDelta {
|
||||||
fn is_initialized(&self) -> bool {
|
fn is_initialized(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ impl ::protobuf::Message for DocDelta {
|
||||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.doc_id)?;
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.doc_id)?;
|
||||||
},
|
},
|
||||||
2 => {
|
2 => {
|
||||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.data)?;
|
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.text)?;
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||||
|
@ -830,8 +830,8 @@ impl ::protobuf::Message for DocDelta {
|
||||||
if !self.doc_id.is_empty() {
|
if !self.doc_id.is_empty() {
|
||||||
my_size += ::protobuf::rt::string_size(1, &self.doc_id);
|
my_size += ::protobuf::rt::string_size(1, &self.doc_id);
|
||||||
}
|
}
|
||||||
if !self.data.is_empty() {
|
if !self.text.is_empty() {
|
||||||
my_size += ::protobuf::rt::string_size(2, &self.data);
|
my_size += ::protobuf::rt::string_size(2, &self.text);
|
||||||
}
|
}
|
||||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||||
self.cached_size.set(my_size);
|
self.cached_size.set(my_size);
|
||||||
|
@ -842,8 +842,8 @@ impl ::protobuf::Message for DocDelta {
|
||||||
if !self.doc_id.is_empty() {
|
if !self.doc_id.is_empty() {
|
||||||
os.write_string(1, &self.doc_id)?;
|
os.write_string(1, &self.doc_id)?;
|
||||||
}
|
}
|
||||||
if !self.data.is_empty() {
|
if !self.text.is_empty() {
|
||||||
os.write_string(2, &self.data)?;
|
os.write_string(2, &self.text)?;
|
||||||
}
|
}
|
||||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||||
::std::result::Result::Ok(())
|
::std::result::Result::Ok(())
|
||||||
|
@ -875,8 +875,8 @@ impl ::protobuf::Message for DocDelta {
|
||||||
Self::descriptor_static()
|
Self::descriptor_static()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new() -> DocDelta {
|
fn new() -> DocumentDelta {
|
||||||
DocDelta::new()
|
DocumentDelta::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||||
|
@ -885,43 +885,43 @@ impl ::protobuf::Message for DocDelta {
|
||||||
let mut fields = ::std::vec::Vec::new();
|
let mut fields = ::std::vec::Vec::new();
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
"doc_id",
|
"doc_id",
|
||||||
|m: &DocDelta| { &m.doc_id },
|
|m: &DocumentDelta| { &m.doc_id },
|
||||||
|m: &mut DocDelta| { &mut m.doc_id },
|
|m: &mut DocumentDelta| { &mut m.doc_id },
|
||||||
));
|
));
|
||||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||||
"data",
|
"text",
|
||||||
|m: &DocDelta| { &m.data },
|
|m: &DocumentDelta| { &m.text },
|
||||||
|m: &mut DocDelta| { &mut m.data },
|
|m: &mut DocumentDelta| { &mut m.text },
|
||||||
));
|
));
|
||||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocDelta>(
|
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocumentDelta>(
|
||||||
"DocDelta",
|
"DocumentDelta",
|
||||||
fields,
|
fields,
|
||||||
file_descriptor_proto()
|
file_descriptor_proto()
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_instance() -> &'static DocDelta {
|
fn default_instance() -> &'static DocumentDelta {
|
||||||
static instance: ::protobuf::rt::LazyV2<DocDelta> = ::protobuf::rt::LazyV2::INIT;
|
static instance: ::protobuf::rt::LazyV2<DocumentDelta> = ::protobuf::rt::LazyV2::INIT;
|
||||||
instance.get(DocDelta::new)
|
instance.get(DocumentDelta::new)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::Clear for DocDelta {
|
impl ::protobuf::Clear for DocumentDelta {
|
||||||
fn clear(&mut self) {
|
fn clear(&mut self) {
|
||||||
self.doc_id.clear();
|
self.doc_id.clear();
|
||||||
self.data.clear();
|
self.text.clear();
|
||||||
self.unknown_fields.clear();
|
self.unknown_fields.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Debug for DocDelta {
|
impl ::std::fmt::Debug for DocumentDelta {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
::protobuf::text_format::fmt(self, f)
|
::protobuf::text_format::fmt(self, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::protobuf::reflect::ProtobufValue for DocDelta {
|
impl ::protobuf::reflect::ProtobufValue for DocumentDelta {
|
||||||
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
|
||||||
::protobuf::reflect::ReflectValueRef::Message(self)
|
::protobuf::reflect::ReflectValueRef::Message(self)
|
||||||
}
|
}
|
||||||
|
@ -1325,64 +1325,64 @@ impl ::protobuf::reflect::ProtobufValue for DocIdentifier {
|
||||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
\n\tdoc.proto\x1a\x0erevision.proto\"R\n\x0fCreateDocParams\x12\x0e\n\
|
\n\tdoc.proto\x1a\x0erevision.proto\"R\n\x0fCreateDocParams\x12\x0e\n\
|
||||||
\x02id\x18\x01\x20\x01(\tR\x02id\x12/\n\trevisions\x18\x02\x20\x01(\x0b2\
|
\x02id\x18\x01\x20\x01(\tR\x02id\x12/\n\trevisions\x18\x02\x20\x01(\x0b2\
|
||||||
\x11.RepeatedRevisionR\trevisions\"`\n\x03Doc\x12\x0e\n\x02id\x18\x01\
|
\x11.RepeatedRevisionR\trevisions\"i\n\x0cDocumentInfo\x12\x0e\n\x02id\
|
||||||
\x20\x01(\tR\x02id\x12\x12\n\x04text\x18\x02\x20\x01(\tR\x04text\x12\x15\
|
\x18\x01\x20\x01(\tR\x02id\x12\x12\n\x04text\x18\x02\x20\x01(\tR\x04text\
|
||||||
\n\x06rev_id\x18\x03\x20\x01(\x03R\x05revId\x12\x1e\n\x0bbase_rev_id\x18\
|
\x12\x15\n\x06rev_id\x18\x03\x20\x01(\x03R\x05revId\x12\x1e\n\x0bbase_re\
|
||||||
\x04\x20\x01(\x03R\tbaseRevId\"]\n\x13ResetDocumentParams\x12\x15\n\x06d\
|
v_id\x18\x04\x20\x01(\x03R\tbaseRevId\"]\n\x13ResetDocumentParams\x12\
|
||||||
oc_id\x18\x01\x20\x01(\tR\x05docId\x12/\n\trevisions\x18\x02\x20\x01(\
|
\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12/\n\trevisions\x18\x02\
|
||||||
\x0b2\x11.RepeatedRevisionR\trevisions\"5\n\x08DocDelta\x12\x15\n\x06doc\
|
\x20\x01(\x0b2\x11.RepeatedRevisionR\trevisions\":\n\rDocumentDelta\x12\
|
||||||
_id\x18\x01\x20\x01(\tR\x05docId\x12\x12\n\x04data\x18\x02\x20\x01(\tR\
|
\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12\x12\n\x04text\x18\x02\
|
||||||
\x04data\"S\n\nNewDocUser\x12\x17\n\x07user_id\x18\x01\x20\x01(\tR\x06us\
|
\x20\x01(\tR\x04text\"S\n\nNewDocUser\x12\x17\n\x07user_id\x18\x01\x20\
|
||||||
erId\x12\x15\n\x06rev_id\x18\x02\x20\x01(\x03R\x05revId\x12\x15\n\x06doc\
|
\x01(\tR\x06userId\x12\x15\n\x06rev_id\x18\x02\x20\x01(\x03R\x05revId\
|
||||||
_id\x18\x03\x20\x01(\tR\x05docId\"&\n\rDocIdentifier\x12\x15\n\x06doc_id\
|
\x12\x15\n\x06doc_id\x18\x03\x20\x01(\tR\x05docId\"&\n\rDocIdentifier\
|
||||||
\x18\x01\x20\x01(\tR\x05docIdJ\xaf\x07\n\x06\x12\x04\0\0\x1c\x01\n\x08\n\
|
\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docIdJ\xaf\x07\n\x06\x12\x04\
|
||||||
\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\x12\x03\x01\0\x18\n\n\n\x02\x04\
|
\0\0\x1c\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\x12\x03\x01\
|
||||||
\0\x12\x04\x03\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x03\x08\x17\n\x0b\n\
|
\0\x18\n\n\n\x02\x04\0\x12\x04\x03\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\
|
||||||
\x04\x04\0\x02\0\x12\x03\x04\x04\x12\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\
|
\x03\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x04\x04\x12\n\x0c\n\x05\x04\
|
||||||
\x04\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x04\x0b\r\n\x0c\n\x05\x04\
|
\0\x02\0\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x04\
|
||||||
\0\x02\0\x03\x12\x03\x04\x10\x11\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x05\
|
\x0b\r\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x04\x10\x11\n\x0b\n\x04\x04\0\
|
||||||
\x04#\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x05\x04\x14\n\x0c\n\x05\x04\
|
\x02\x01\x12\x03\x05\x04#\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x05\x04\
|
||||||
\0\x02\x01\x01\x12\x03\x05\x15\x1e\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\
|
\x14\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x05\x15\x1e\n\x0c\n\x05\x04\0\
|
||||||
\x05!\"\n\n\n\x02\x04\x01\x12\x04\x07\0\x0c\x01\n\n\n\x03\x04\x01\x01\
|
\x02\x01\x03\x12\x03\x05!\"\n\n\n\x02\x04\x01\x12\x04\x07\0\x0c\x01\n\n\
|
||||||
\x12\x03\x07\x08\x0b\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x08\x04\x12\n\x0c\
|
\n\x03\x04\x01\x01\x12\x03\x07\x08\x14\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
|
||||||
\n\x05\x04\x01\x02\0\x05\x12\x03\x08\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\
|
\x08\x04\x12\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x08\x04\n\n\x0c\n\x05\
|
||||||
\x12\x03\x08\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x08\x10\x11\n\
|
\x04\x01\x02\0\x01\x12\x03\x08\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\
|
||||||
\x0b\n\x04\x04\x01\x02\x01\x12\x03\t\x04\x14\n\x0c\n\x05\x04\x01\x02\x01\
|
\x03\x08\x10\x11\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\t\x04\x14\n\x0c\n\
|
||||||
\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\t\x0b\x0f\n\
|
\x05\x04\x01\x02\x01\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\
|
||||||
\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\t\x12\x13\n\x0b\n\x04\x04\x01\x02\
|
\x12\x03\t\x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\t\x12\x13\n\
|
||||||
\x02\x12\x03\n\x04\x15\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\n\x04\t\n\
|
\x0b\n\x04\x04\x01\x02\x02\x12\x03\n\x04\x15\n\x0c\n\x05\x04\x01\x02\x02\
|
||||||
\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\n\n\x10\n\x0c\n\x05\x04\x01\x02\
|
\x05\x12\x03\n\x04\t\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\n\n\x10\n\
|
||||||
\x02\x03\x12\x03\n\x13\x14\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x0b\x04\
|
\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\n\x13\x14\n\x0b\n\x04\x04\x01\x02\
|
||||||
\x1a\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\x0b\x04\t\n\x0c\n\x05\x04\
|
\x03\x12\x03\x0b\x04\x1a\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\x0b\x04\
|
||||||
\x01\x02\x03\x01\x12\x03\x0b\n\x15\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\
|
\t\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\x0b\n\x15\n\x0c\n\x05\x04\x01\
|
||||||
\x03\x0b\x18\x19\n\n\n\x02\x04\x02\x12\x04\r\0\x10\x01\n\n\n\x03\x04\x02\
|
\x02\x03\x03\x12\x03\x0b\x18\x19\n\n\n\x02\x04\x02\x12\x04\r\0\x10\x01\n\
|
||||||
\x01\x12\x03\r\x08\x1b\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x0e\x04\x16\n\
|
\n\n\x03\x04\x02\x01\x12\x03\r\x08\x1b\n\x0b\n\x04\x04\x02\x02\0\x12\x03\
|
||||||
\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0e\x04\n\n\x0c\n\x05\x04\x02\x02\0\
|
\x0e\x04\x16\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0e\x04\n\n\x0c\n\x05\
|
||||||
\x01\x12\x03\x0e\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x0e\x14\
|
\x04\x02\x02\0\x01\x12\x03\x0e\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\x03\x12\
|
||||||
\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0f\x04#\n\x0c\n\x05\x04\x02\
|
\x03\x0e\x14\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x0f\x04#\n\x0c\n\
|
||||||
\x02\x01\x06\x12\x03\x0f\x04\x14\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\
|
\x05\x04\x02\x02\x01\x06\x12\x03\x0f\x04\x14\n\x0c\n\x05\x04\x02\x02\x01\
|
||||||
\x0f\x15\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x0f!\"\n\n\n\x02\
|
\x01\x12\x03\x0f\x15\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x0f!\"\
|
||||||
\x04\x03\x12\x04\x11\0\x14\x01\n\n\n\x03\x04\x03\x01\x12\x03\x11\x08\x10\
|
\n\n\n\x02\x04\x03\x12\x04\x11\0\x14\x01\n\n\n\x03\x04\x03\x01\x12\x03\
|
||||||
\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x12\x04\x16\n\x0c\n\x05\x04\x03\x02\0\
|
\x11\x08\x15\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x12\x04\x16\n\x0c\n\x05\
|
||||||
\x05\x12\x03\x12\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x12\x0b\x11\
|
\x04\x03\x02\0\x05\x12\x03\x12\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\x12\
|
||||||
\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x12\x14\x15\n\x0b\n\x04\x04\x03\
|
\x03\x12\x0b\x11\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x12\x14\x15\n\x0b\
|
||||||
\x02\x01\x12\x03\x13\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x13\
|
\n\x04\x04\x03\x02\x01\x12\x03\x13\x04\x14\n\x0c\n\x05\x04\x03\x02\x01\
|
||||||
\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x13\x0b\x0f\n\x0c\n\x05\
|
\x05\x12\x03\x13\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x13\x0b\
|
||||||
\x04\x03\x02\x01\x03\x12\x03\x13\x12\x13\n\n\n\x02\x04\x04\x12\x04\x15\0\
|
\x0f\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x13\x12\x13\n\n\n\x02\x04\
|
||||||
\x19\x01\n\n\n\x03\x04\x04\x01\x12\x03\x15\x08\x12\n\x0b\n\x04\x04\x04\
|
\x04\x12\x04\x15\0\x19\x01\n\n\n\x03\x04\x04\x01\x12\x03\x15\x08\x12\n\
|
||||||
\x02\0\x12\x03\x16\x04\x17\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x16\x04\
|
\x0b\n\x04\x04\x04\x02\0\x12\x03\x16\x04\x17\n\x0c\n\x05\x04\x04\x02\0\
|
||||||
\n\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03\x16\x0b\x12\n\x0c\n\x05\x04\x04\
|
\x05\x12\x03\x16\x04\n\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03\x16\x0b\x12\
|
||||||
\x02\0\x03\x12\x03\x16\x15\x16\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\x17\
|
\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x16\x15\x16\n\x0b\n\x04\x04\x04\
|
||||||
\x04\x15\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\x17\x04\t\n\x0c\n\x05\
|
\x02\x01\x12\x03\x17\x04\x15\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\x17\
|
||||||
\x04\x04\x02\x01\x01\x12\x03\x17\n\x10\n\x0c\n\x05\x04\x04\x02\x01\x03\
|
\x04\t\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03\x17\n\x10\n\x0c\n\x05\x04\
|
||||||
\x12\x03\x17\x13\x14\n\x0b\n\x04\x04\x04\x02\x02\x12\x03\x18\x04\x16\n\
|
\x04\x02\x01\x03\x12\x03\x17\x13\x14\n\x0b\n\x04\x04\x04\x02\x02\x12\x03\
|
||||||
\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03\x18\x04\n\n\x0c\n\x05\x04\x04\x02\
|
\x18\x04\x16\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03\x18\x04\n\n\x0c\n\
|
||||||
\x02\x01\x12\x03\x18\x0b\x11\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03\x18\
|
\x05\x04\x04\x02\x02\x01\x12\x03\x18\x0b\x11\n\x0c\n\x05\x04\x04\x02\x02\
|
||||||
\x14\x15\n\n\n\x02\x04\x05\x12\x04\x1a\0\x1c\x01\n\n\n\x03\x04\x05\x01\
|
\x03\x12\x03\x18\x14\x15\n\n\n\x02\x04\x05\x12\x04\x1a\0\x1c\x01\n\n\n\
|
||||||
\x12\x03\x1a\x08\x15\n\x0b\n\x04\x04\x05\x02\0\x12\x03\x1b\x04\x16\n\x0c\
|
\x03\x04\x05\x01\x12\x03\x1a\x08\x15\n\x0b\n\x04\x04\x05\x02\0\x12\x03\
|
||||||
\n\x05\x04\x05\x02\0\x05\x12\x03\x1b\x04\n\n\x0c\n\x05\x04\x05\x02\0\x01\
|
\x1b\x04\x16\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03\x1b\x04\n\n\x0c\n\x05\
|
||||||
\x12\x03\x1b\x0b\x11\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03\x1b\x14\x15b\
|
\x04\x05\x02\0\x01\x12\x03\x1b\x0b\x11\n\x0c\n\x05\x04\x05\x02\0\x03\x12\
|
||||||
\x06proto3\
|
\x03\x1b\x14\x15b\x06proto3\
|
||||||
";
|
";
|
||||||
|
|
||||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
|
|
@ -5,7 +5,7 @@ message CreateDocParams {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
RepeatedRevision revisions = 2;
|
RepeatedRevision revisions = 2;
|
||||||
}
|
}
|
||||||
message Doc {
|
message DocumentInfo {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string text = 2;
|
string text = 2;
|
||||||
int64 rev_id = 3;
|
int64 rev_id = 3;
|
||||||
|
@ -15,9 +15,9 @@ message ResetDocumentParams {
|
||||||
string doc_id = 1;
|
string doc_id = 1;
|
||||||
RepeatedRevision revisions = 2;
|
RepeatedRevision revisions = 2;
|
||||||
}
|
}
|
||||||
message DocDelta {
|
message DocumentDelta {
|
||||||
string doc_id = 1;
|
string doc_id = 1;
|
||||||
string data = 2;
|
string text = 2;
|
||||||
}
|
}
|
||||||
message NewDocUser {
|
message NewDocUser {
|
||||||
string user_id = 1;
|
string user_id = 1;
|
||||||
|
|
|
@ -92,14 +92,14 @@ impl TryInto<UpdateViewParams> for UpdateViewRequest {
|
||||||
// pub data: String,
|
// pub data: String,
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// impl TryInto<DocDelta> for DocDeltaRequest {
|
// impl TryInto<DocumentDelta> for DocDeltaRequest {
|
||||||
// type Error = FlowyError;
|
// type Error = FlowyError;
|
||||||
//
|
//
|
||||||
// fn try_into(self) -> Result<DocDelta, Self::Error> {
|
// fn try_into(self) -> Result<DocumentDelta, Self::Error> {
|
||||||
// let view_id = ViewId::parse(self.view_id)
|
// let view_id = ViewId::parse(self.view_id)
|
||||||
// .map_err(|e| FlowyError::view_id().context(e))?
|
// .map_err(|e| FlowyError::view_id().context(e))?
|
||||||
// .0;
|
// .0;
|
||||||
//
|
//
|
||||||
// Ok(DocDelta { doc_id: view_id, data: self.data })
|
// Ok(DocumentDelta { doc_id: view_id, data: self.data })
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -32,9 +32,9 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
|
||||||
| "UpdateUserRequest"
|
| "UpdateUserRequest"
|
||||||
| "UpdateUserParams"
|
| "UpdateUserParams"
|
||||||
| "CreateDocParams"
|
| "CreateDocParams"
|
||||||
| "Doc"
|
| "DocumentInfo"
|
||||||
| "ResetDocumentParams"
|
| "ResetDocumentParams"
|
||||||
| "DocDelta"
|
| "DocumentDelta"
|
||||||
| "NewDocUser"
|
| "NewDocUser"
|
||||||
| "DocIdentifier"
|
| "DocIdentifier"
|
||||||
| "Revision"
|
| "Revision"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue