Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add
doc.subscribe('status', callback)
function #828Add
doc.subscribe('status', callback)
function #828Changes from all commits
f28885a
c06ebfb
312bdce
d9bfc4c
d0863a3
3c3565c
b9d9d5e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that when another peer deactivates a deleted document, the status events occur in the order verified in the test.
The event verification is duplicated when first attaching and removing to show which events occur in order. Since the important part is number 3, it might be sufficient to verify only that part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your reply. I want some more conversation for clearly understanding.
is peer means client object(e.g. c1 or c2)?
According to your explanation, this tc doesn't need verification with two clients and documents. If this tc's purpose is verification with
c2.deactivate()
, i looks like only needed for c2 and d2. So I think it's enough with just one client and document. Would you please explain what is the point to use c1 and d1?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your question and for seeking clarification. Let me provide more details:
peer
is used to refer to a client other than oneself.When a client (c1) removes a document, the document's state becomes "removed," and the connection to the server is terminated.
Now, we need to verify how another client (c2) should handle receiving the Change that the document has been removed. This can be examined in two scenarios:
When c2 sends a sync request (note that detach behaves similarly as it also receives the change that the document was removed):
// 6. When c2 syncs, it should also receive a removed event.
When c2 deactivates without syncing (or detaching):
// 3. When c2 deactivates, it should also receive a removed event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your very helpful comment.
I can almost understand after this comment why this tc was written.
I think this is the point that confused me, I didn't understand why step 2 is needed. It seems like step 2 is created to verifying for removed, but with the current specification, step 3 is checking for detached, and the test succeeds without step 2. (I tested this on my android sdk's test code)
This tc seems to be that contains part of the future spec(number2) and part of the current spec(number3) at the same time, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maruldy I'm glad my comment was helpful.
Step 2(
//2. When c1 removes a document, it receives a removed event.
) is a separate verification from step 3. It's not a verification of the future spec, but rather a test to verify that d1 receives a "removed" event when c1 removes the document.In the case of the future spec, as noted, after c2 deactivates in step 3, d2 should receive a "removed" status event instead of "detached".
From the previous answer,
This is what step 2 verifies. (d1 event)
This is what step 3 verifies. (d2 event)
Since our focus is on d2, it might be sufficient to verify events only for d2 without verifying events for d1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chacha912
Thanks for your reply.
Now I understand why this TC is contains step 2 and 3.
It's to validate that after calling c1.remove(), the detached event is still being received, and if the spec changes in the future to allow remove to be received, you'll want to modify this TC again then, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maruldy Yes, this test (step 3) checks if a 'detached' event occurs when c2 deactivates. And a comment is added to indicate that we might need to modify this test later if we change how things work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for long conversation. :) I'll replicate this tc to android sdk. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chacha912
Would you explain your plan about this comment?
Until
0.4.25-rc
of Yorkie Android sdk, it doesn't update status to detached when deactivating.I found it with yorkie-js-sdk's test code, and I'll add a commit for fix it. (But PR is not yet. I'll make it after apply 0.4.27~28.)
I made a consensus about this with @7hong13
But, I found this comment now, I want to check this how it will be changed future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maruldy At that time, there was a possibility of reattaching a document after detaching it, and it hadn't been decided whether deactivate should perform detach. So I left a
NOTE
.If it's later decided that deactivate should include the same process of detaching the document, I considered that when c2 deactivates, it would receive the change of c1 removing the document, resulting in the final document status changing to
removed
.Currently, when deactivating, only
deactivateInternal
is performed internally, changing all document statuses todetached
, so the final document status changes todetached
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this thread is resolved via below conversation. Thanks.