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

Replace Text.select with Presence #583

Closed
3 tasks done
hackerwins opened this issue Jul 19, 2023 · 8 comments
Closed
3 tasks done

Replace Text.select with Presence #583

hackerwins opened this issue Jul 19, 2023 · 8 comments
Labels
cleanup 🧹 Paying off technical debt good first issue 🐤 Good for newcomers sdk ⚒️

Comments

@hackerwins
Copy link
Member

hackerwins commented Jul 19, 2023

Description:

Recently we introduced batch updates of documents and presences to provide atomic change delivery and events from document.subscribe. All operations and presence changes created in document.update guarantee atomic delivery, So we can replace Text.select with presence and delete the method for now.

// Before
doc.update((root) => {
  root.text = new yorkie.Text();            // {"text":""}
  root.text.edit(0, 0, 'hello');            // {"text":"hello"}
  root.text.select(0, 1);                   // {"text":"^h^ello"}
});

// After
doc.update((root, presence) => {
  root.text = new yorkie.Text();                          // {"text":""}
  root.text.edit(0, 0, 'hello');                          // {"text":"hello"}
  presence.set('selection', root.text.createRange(0, 1)); // {"text":"^h^ello"}
});

We need to do the below:

  • Provide Text.createRange
  • Replace Text.select with presence in all Text examples
  • Remove Select operation from Text

Batch updates of documents and presences:

Why:

  • Clean up unnecessary features to keep the product simple.
@joonhyukchoi
Copy link
Contributor

I'm interested in this issue. can i work on it?

@krapie
Copy link
Member

krapie commented Jul 22, 2023

@joonhyukchoi sure! give it a try!

@joonhyukchoi
Copy link
Contributor

joonhyukchoi commented Jul 24, 2023

May i ask you a question? If i remove Select in protobuf and reorder tags like below, could there be compatibility issues with before version? i found that compatibility mention in the proto buffer documentation.

oneof body {
Set set = 1;
Add add = 2;
Move move = 3;
Remove remove = 4;
Edit edit = 5;
// Select select = 6;
Style style = 6; // bef: 7
Increase increase = 7; // bef: 8
TreeEdit tree_edit = 8; // bef: 9
TreeStyle tree_style = 9; // bef: 10
}

@chacha912
Copy link
Contributor

@joonhyukchoi Yes. When making that changes to protobuf, there can be compatibility issues with previous versions. In such cases, we have been labeling issues and PRs with protocol changed📝 to indicate the compatibility impact.
(Since there have been no real production yet, we have been working on it with breaking version compatibility.)

@joonhyukchoi
Copy link
Contributor

@chacha912 Thank you. I'll follow that!

@hackerwins
Copy link
Member Author

@joonhyukchoi, @chacha912

We need to consider two things when modifying Protobuf message:

A. Changing the protocol on the API used for communication between the Client and Server:
When there are issues with communication between the Client and Server, we can resolve them by updating the SDK version.

B. Changing the data protocol stored in the database:
Data stored by the previous version of the Server cannot be read by the new version of the Server. In this case, we need to migrate the existing data stored in the database. (We have to update the operations of the changes saved in CodePair.)

Since the protocol of the operation has been changed in #589, it applies to both the first and second scenarios mentioned above. Therefore, we also need to consider how to migrate the existing data.

@blurfx
Copy link
Member

blurfx commented Aug 19, 2023

I'll work on the js sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Paying off technical debt good first issue 🐤 Good for newcomers sdk ⚒️
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants