From 2bfa517dcd0e8ad0d7b6b4f96a0916e57f951233 Mon Sep 17 00:00:00 2001 From: jee-hyun-kim Date: Thu, 18 Jan 2024 15:38:58 +0900 Subject: [PATCH 1/2] remove toPath in TreeStyleOpInfo --- .../kotlin/dev/yorkie/document/operation/OperationInfo.kt | 1 - .../dev/yorkie/document/operation/TreeStyleOperation.kt | 1 - .../src/test/kotlin/dev/yorkie/document/json/JsonTreeTest.kt | 4 ---- 3 files changed, 6 deletions(-) diff --git a/yorkie/src/main/kotlin/dev/yorkie/document/operation/OperationInfo.kt b/yorkie/src/main/kotlin/dev/yorkie/document/operation/OperationInfo.kt index da299301d..30a821c9e 100644 --- a/yorkie/src/main/kotlin/dev/yorkie/document/operation/OperationInfo.kt +++ b/yorkie/src/main/kotlin/dev/yorkie/document/operation/OperationInfo.kt @@ -92,7 +92,6 @@ public sealed class OperationInfo { val from: Int, val to: Int, val fromPath: List, - val toPath: List, val attributes: Map, override var path: String = INITIAL_PATH, ) : OperationInfo(), TreeOperationInfo diff --git a/yorkie/src/main/kotlin/dev/yorkie/document/operation/TreeStyleOperation.kt b/yorkie/src/main/kotlin/dev/yorkie/document/operation/TreeStyleOperation.kt index 76eed880c..d926717d7 100644 --- a/yorkie/src/main/kotlin/dev/yorkie/document/operation/TreeStyleOperation.kt +++ b/yorkie/src/main/kotlin/dev/yorkie/document/operation/TreeStyleOperation.kt @@ -36,7 +36,6 @@ internal data class TreeStyleOperation( it.from, it.to, it.fromPath, - it.toPath, it.attributes.orEmpty(), root.createPath(parentCreatedAt), ) diff --git a/yorkie/src/test/kotlin/dev/yorkie/document/json/JsonTreeTest.kt b/yorkie/src/test/kotlin/dev/yorkie/document/json/JsonTreeTest.kt index f7e826358..254f6d93a 100644 --- a/yorkie/src/test/kotlin/dev/yorkie/document/json/JsonTreeTest.kt +++ b/yorkie/src/test/kotlin/dev/yorkie/document/json/JsonTreeTest.kt @@ -319,12 +319,10 @@ class JsonTreeTest { 0, "$.t", ), - // TODO(7hong13): need to check whether toPath is correctly passed TreeStyleOpInfo( 0, 1, listOf(0), - listOf(0, 0), mapOf("a" to "b"), "$.t", ), @@ -387,12 +385,10 @@ class JsonTreeTest { 0, "$.t", ), - // TODO(7hong13): need to check whether toPath is correctly passed TreeStyleOpInfo( 2, 3, listOf(0, 0, 0), - listOf(0, 0, 0, 0), mapOf("a" to "b"), "$.t", ), From d90cd2d7bdf51d54008ec5caf99c25b448a231be Mon Sep 17 00:00:00 2001 From: jee-hyun-kim Date: Sat, 20 Jan 2024 15:17:44 +0900 Subject: [PATCH 2/2] Reflect interface changes of server DB sharding --- yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto | 10 +++++++++- .../dev/yorkie/document/json/JsonTreeSplitMergeTest.kt | 2 +- yorkie/src/main/kotlin/dev/yorkie/core/Client.kt | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto b/yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto index 377b269b8..46e93fd05 100644 --- a/yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto +++ b/yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto @@ -48,6 +48,7 @@ message ActivateClientResponse { } message DeactivateClientRequest { + string client_key = 2; string client_id = 1; } @@ -55,6 +56,7 @@ message DeactivateClientResponse { } message AttachDocumentRequest { + string client_key = 3; string client_id = 1; ChangePack change_pack = 2; } @@ -65,6 +67,7 @@ message AttachDocumentResponse { } message DetachDocumentRequest { + string client_key = 5; string client_id = 1; string document_id = 2; ChangePack change_pack = 3; @@ -76,7 +79,9 @@ message DetachDocumentResponse { } message WatchDocumentRequest { + string client_key = 4; string client_id = 1; + string document_key = 3; string document_id = 2; } @@ -92,6 +97,7 @@ message WatchDocumentResponse { } message RemoveDocumentRequest { + string client_key = 4; string client_id = 1; string document_id = 2; ChangePack change_pack = 3; @@ -102,6 +108,7 @@ message RemoveDocumentResponse { } message PushPullChangesRequest { + string client_key = 5; string client_id = 1; string document_id = 2; ChangePack change_pack = 3; @@ -113,7 +120,9 @@ message PushPullChangesResponse { } message BroadcastRequest { + string client_key = 6; string client_id = 1; + string document_key = 5; string document_id = 2; string topic = 3; bytes payload = 4; @@ -121,4 +130,3 @@ message BroadcastRequest { message BroadcastResponse { } - diff --git a/yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeSplitMergeTest.kt b/yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeSplitMergeTest.kt index 9c68bde9e..cbc20773d 100644 --- a/yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeSplitMergeTest.kt +++ b/yorkie/src/androidTest/kotlin/dev/yorkie/document/json/JsonTreeSplitMergeTest.kt @@ -244,7 +244,7 @@ class JsonTreeSplitMergeTest { } @Test - fun test_split_and_merge_with_empty_paragraph_left_and_multiple_split_level_left() { + fun test_split_and_merge_with_empty_paragraph_and_multiple_split_level_left() { withTwoClientsAndDocuments(realTimeSync = false) { c1, c2, d1, d2, _ -> d1.updateAsync { root, _ -> root.setNewTree( diff --git a/yorkie/src/main/kotlin/dev/yorkie/core/Client.kt b/yorkie/src/main/kotlin/dev/yorkie/core/Client.kt index c4d01d25b..35413ccb5 100644 --- a/yorkie/src/main/kotlin/dev/yorkie/core/Client.kt +++ b/yorkie/src/main/kotlin/dev/yorkie/core/Client.kt @@ -207,6 +207,7 @@ public class Client @VisibleForTesting internal constructor( changePack = document.createChangePack().toPBChangePack() documentId = documentID pushOnly = syncMode == SyncMode.PushOnly + clientKey = options.key } val response = service.pushPullChanges( request, @@ -257,6 +258,8 @@ public class Client @VisibleForTesting internal constructor( watchDocumentRequest { clientId = requireClientId().value documentId = attachment.documentID + clientKey = options.key + documentKey = attachment.document.key.value }, documentBasedRequestHeader(attachment.document.key), ).retry { @@ -350,6 +353,7 @@ public class Client @VisibleForTesting internal constructor( val request = attachDocumentRequest { clientId = requireClientId().value changePack = document.createChangePack().toPBChangePack() + clientKey = options.key } val response = try { service.attachDocument( @@ -402,6 +406,7 @@ public class Client @VisibleForTesting internal constructor( clientId = requireClientId().value changePack = document.createChangePack().toPBChangePack() documentId = attachment.documentID + clientKey = options.key } val response = try { service.detachDocument( @@ -437,6 +442,7 @@ public class Client @VisibleForTesting internal constructor( service.deactivateClient( deactivateClientRequest { clientId = requireClientId().value + clientKey = options.key }, projectBasedRequestHeader, ) @@ -464,6 +470,7 @@ public class Client @VisibleForTesting internal constructor( clientId = requireClientId().value changePack = document.createChangePack(forceRemove = true).toPBChangePack() documentId = attachment.documentID + clientKey = options.key } val response = try { service.removeDocument(