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

Update events break if one node's clock is ahead #1

Open
CoderPuppy opened this issue Nov 20, 2013 · 10 comments
Open

Update events break if one node's clock is ahead #1

CoderPuppy opened this issue Nov 20, 2013 · 10 comments

Comments

@CoderPuppy
Copy link

Two nodes: A and B
B's clock is ahead of A's
When A deletes a value added by B it doesn't include it in the update event, thus there is no notification that the value is removed. The value does get removed from node A though.

@dominictarr
Copy link
Owner

yes. what is needed is a way to provided adjusted clocks.
probably by pinging back and forth, and deciding on a compromise time.
that can be a separate streaming protocol...
I've been aware of this problem a while, but I've been waiting for someone to have this problem to fix it.

@CoderPuppy
Copy link
Author

A quick fix is to only check the timestamp if the source of the new update is the same as the source of the one in the history.

@dominictarr
Copy link
Owner

that would mean that only the original author can update the items they create.
If that is what you need... sure, but it breaks the idea of collaborative software.

@CoderPuppy
Copy link
Author

Sorry if I was confusing. What I was saying is to allow the update if the source if different or the timestamp is larger.

@dominictarr
Copy link
Owner

Sorry this is still confusing.

Can you explain this in terms of a concrete example, of some thing that you are intending to use r-array for? Explain how the problem arises, and what the effects are on the user.

Explaining a problem interms of an actual use-case is very helpful, because I can also apply what I know about that usecase, which may reveal new approaches to the problem...

@CoderPuppy
Copy link
Author

I'm using it for a chat. I have a bot that deletes messages, when it deletes a message (coming from a source which's clock is ahead) none of the clients react to it. Also I have a clear button, when I click it deletes the messages from the clients r-array but since it doesn't include the update in the update event it doesn't remove the elements from the page, also the messages still exist on all other clients (and the server).

@dominictarr
Copy link
Owner

oh, okay.

does the bot delete old messages? or is it just offensive, etc? messages?
the bot's update needs to be ahead of the message it is deleting.

if it's just deleting old messages it would be better to have each client delete the messages,
then there is no extra IO to be sent.

If you need a centralized deleter, but are having clock problems, you could delete make a delete message that has a newer timestamp...

you could just make your own localUpdate to set a timestamp that is ahead on the message you are deleting.

https://github.com/dominictarr/scuttlebutt/blob/master/index.js#L58

@dominictarr
Copy link
Owner

to solve this problem more generally, the scuttlebutt's clock should probably be exposed, or passed in some way...

@CoderPuppy
Copy link
Author

I guess really what I need is an authority system, give all scuttlebutts full authority over themselves and on the server regulate it so everything but setting non-existent keys is blocked for most scuttlebutts and then trust other ones somehow.

@dominictarr
Copy link
Owner

there is this module https://github.com/juliangruber/authoritee

also, it maybe of interest to read through this issue dominictarr/scuttlebutt#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants