-
Notifications
You must be signed in to change notification settings - Fork 4
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
Async API for Notifications & Delay-Tolerant Synchronisation #248
Comments
Our notification system is sort of delay tolerant synchronisation, or human-in-the-loop interactions. We can think of notifications as an interaction that requires the human to take action before the interaction can complete. As for being able to "send", it would require an outbox system that retries sending. This is getting closer to reimplementing email... so we need to ensure we don't feature creep too much here. Which is why looking into Async API standard is a good idea: https://www.asyncapi.com/docs/concepts/message Email as a protocol is really insecure and very clunky and old. It's just really hard to automate (wasn't designed to be machine-parseable). |
QUIC streams will make this cheap to do. We can "pull" to establish a stream, then react to data that is pushed over the stream. As for delay tolerance, that will require something else. It's sort like a buffer with a retry. A sort of out-box for operations. It's possible we can re-use our task system to do the retry, and not have to develop domain-specific outboxes. |
For delay tolerant operations we can make use of the task scheduler. If we attempt some RPC operation such as sending a notification and it fails. We can schedule a task to retry it after some delay. If the task fails again we can try again after a longer delay. There should be a threshold for attempts where we give up altogether. |
Therefore I don't think we need any API changes. We're have all the building blocks. Async API could be useful to standardise our notification-related API. But right now that's going to be overkill (because also we have a lot of other API related behaviour that has nothing to do with async calls) so I'm going to say wontfix atm. One could certainly use our JSON RPC API to build the async API. I think we will have a better idea of what exactly we need when we spec out the interaction between PKE and Polykey as well as Polykey-Desktop, where the CLI is just one interface. And the CLI interface is very batchy, so it doesn't even make use of async API much, but PKE and desktop will do so. Will revisit when needed. @amydevs |
This ended up being implemented (to some extent) in #695. |
Specification
The notifications system is better understood as a message queueing system (https://en.wikipedia.org/wiki/Message_queue). Communications is currently implemented with gRPC, meaning notifications is built in the RPC paradigm.
There are some benefits to choosing a messaging paradigm instead.
It's possible to build a messaging system on top of RPC. Actually RPC and messaging are sort of equivalent, in that RPC can be built on top of a messaging protocol and messaging can be built on top of RPC. See https://github.com/yarpc/yarpc-go as an example of messaging system on top of gRPC.
Right now our architecture has gRPC on top of a lower transport-level network domain. We could build a messaging system on top of gRPC but we would be reimplementing alot of features that other messaging protocols already have.
In addition to notifications, there's also the desire to build lazy gossip protocol that helps us replicate and have eventually consistent gestalt graph as well as ACL state.
We need to think holistically here and ensure that anything we build for an asynchronous messaging-paradigm can be used for all these usecases and constraints:
A good place to start would be to review the AsyncAPI standard: https://www.asyncapi.com/docs/specifications/v2.2.0#definitionsProtocol. This standard is about describing asynchronous protocols similar to OpenAPI which is used primarily for RESTful or RPCful HTTP APIs.
We should also be aware of how this relates to synchronous transactions that are currently occurring in a blocking manner. If they can be redesigned to be asynchronous, we could improve UX and avoid blocking operations over the network.
Additional context
timedCancellable
toSigchain
such as the deadline in nodes claim process #243 - deadlines in node claim processTasks
The text was updated successfully, but these errors were encountered: