Skip to content

Does a client send the same kind of delta messages as it receives? #271

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

Closed
enikao opened this issue May 19, 2024 · 9 comments
Closed

Does a client send the same kind of delta messages as it receives? #271

enikao opened this issue May 19, 2024 · 9 comments

Comments

@enikao
Copy link
Contributor

enikao commented May 19, 2024

Is there any difference between the messages a client sends and receives via delta protocol?

A Different kind of messages per direction

Maybe the client sends "I'd like to change the property x of node y to z" and it receives either "property x of node y changed to z" or "property x of node y to zzzz" (e.g. because of some conflict resolution)?

Pro:

  • If we conceptually think of "Command/Intent" as different from "Event", we should separate them also technically.

Con:

  • Both directions might look very similar in terms of the possible messages, as everything a client does needs to be communicated to all other clients, and this protocol is very low-level.

B Same kind of messages per direction

Client sends "property x of node y changed to z" and receives the same kind of message "property a of node b changed to c".

Pro:

  • Simpler
  • Clients may communicate directly with each other (not really part of our scenario)
@enikao enikao added the delta label May 19, 2024
@dslmeinte
Copy link
Contributor

I think a change should be initiated as a Command in CQRS-parlance, and then be broadcast by a repository as an Event. Commands and Events are often quite similar in payload, though.

@joswarmer
Copy link
Contributor

I like B as it is much more clear.

@joswarmer
Copy link
Contributor

Both clients and servers send deltas stating 'this has changed in the model'. So they do exactly the same and therefore I don't see why they should use different deltas.

@dslmeinte
Copy link
Contributor

That does imply complete symmetry, so e.g. a repository can't reject a delta.

@joswarmer
Copy link
Contributor

You are right, a repository can reject a delta, and a client cannot.

@slisson
Copy link

slisson commented May 23, 2024

The idea of rejecting changes from the client could be generalized into something that alignes more with the OT approach.

In OT, conflicts are resolved by "transforming" an "operation" into a different one, which means replacing it with an operation that is equivalent to its original intent but valid to be applied on a different state of the model. Some conflicts can be resolved by giving one of the operations precedence and transforming the other operation into an empty one (NoOp).

Rejecting a change in OT terms means replacing it with a NoOp. Such a protocol would allow the server to apply more advanced conflict resolution strategies, but also allow the rejection strategy.

For the client it shouldn't be a big difference. In both cases it needs to be able to roll back its own changes and apply different ones.

@enikao
Copy link
Contributor Author

enikao commented Jun 21, 2024

Preliminary assumption on 2024-06-21: Option B

Rationale: We don't see a really good case for A (yet). If we decided in favor of #273, that might be a case for A.

@enikao
Copy link
Contributor Author

enikao commented Jul 6, 2024

Does this still hold with #280 event giveUpDeltasJustReload? It feels like this event can only be sent by the repository.

@enikao
Copy link
Contributor Author

enikao commented Aug 2, 2024

Decision: Option A: Distinct commands and events

Details see #291

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

No branches or pull requests

4 participants