Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect interface changes of server DB sharding #152

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion yorkie/proto/src/main/proto/yorkie/v1/yorkie.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ message ActivateClientResponse {
}

message DeactivateClientRequest {
string client_key = 2;
string client_id = 1;
}

message DeactivateClientResponse {
}

message AttachDocumentRequest {
string client_key = 3;
string client_id = 1;
ChangePack change_pack = 2;
}
Expand All @@ -65,6 +67,7 @@ message AttachDocumentResponse {
}

message DetachDocumentRequest {
string client_key = 5;
string client_id = 1;
string document_id = 2;
ChangePack change_pack = 3;
Expand All @@ -76,7 +79,9 @@ message DetachDocumentResponse {
}

message WatchDocumentRequest {
string client_key = 4;
string client_id = 1;
string document_key = 3;
string document_id = 2;
}

Expand All @@ -92,6 +97,7 @@ message WatchDocumentResponse {
}

message RemoveDocumentRequest {
string client_key = 4;
string client_id = 1;
string document_id = 2;
ChangePack change_pack = 3;
Expand All @@ -102,6 +108,7 @@ message RemoveDocumentResponse {
}

message PushPullChangesRequest {
string client_key = 5;
string client_id = 1;
string document_id = 2;
ChangePack change_pack = 3;
Expand All @@ -113,12 +120,13 @@ 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;
}

message BroadcastResponse {
}

Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions yorkie/src/main/kotlin/dev/yorkie/core/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -437,6 +442,7 @@ public class Client @VisibleForTesting internal constructor(
service.deactivateClient(
deactivateClientRequest {
clientId = requireClientId().value
clientKey = options.key
},
projectBasedRequestHeader,
)
Expand Down Expand Up @@ -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(
Expand Down
Loading