Advertise and call remote flows #85
Merged
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.
Distributed Flow Execution Support
This PR introduces the foundation for building distributed computing networks using flowstate.
Each node in the network can advertise the flows it owns (see SetFlow). What's particularly elegant is that there's no need for a separate API or service for discovery — advertising is done through the same state commit mechanism. It's recursion all the way down.
Other nodes observe these flow states (see watchFlows) and update their local registries accordingly. When a flow is invoked (see netflow.Flow), the call is routed directly to the node that owns the flow. The coordinator is only used for advertisement (see SetFlow, UnsetFlow, watchFlows), not execution.
This approach allows flows to be dynamically added and removed.
🔍 The most interesting part of the code is here: https://github.com/makasim/flowstate/pull/85/files#diff-eb98dc8149917fa74f4e8f21baa0e3d514ae300b65714f6627e2b09626a8a93fR125
Depends on #84