Marlowe Runtime "Follower" Architecture #142
Locked
jhbertra
started this conversation in
Architecture
Replies: 2 comments 3 replies
-
This looks great, and I think it would be feasible and efficient. Here are two questions about eliminating redundant paths in order to reduce the chances for receiving conflicting or out-of-sync data.
|
Beta Was this translation helpful? Give feedback.
3 replies
-
@bwbush here is an updated diagram based on your first suggestion: flowchart
node[MARLOWE_RT_NODE_SOCKET]
sport[MARLOWE_RT_STREAMING_PORT]
qport[MARLOWE_RT_QUERY_PORT]
subgraph Marlowe Runtime
cs[Chain Sync Client]
hp[History Processor]
hp[History Processor]
hstore[History Store]
cstore[Contract Store]
sserv[Streaming Server]
sser[Streaming API]
qserv[Query Server]
qser[Query API]
cs--"Marlowe Chain Events"-->hp
hp--History Events-->hstore
hp--History Events-->cstore
hstore--History Events-->sserv
hstore-.History Events.->qserv
cstore-.Contracts.->qserv
sserv--Pub Messages-->sser
qserv-.Queries/Results.->qser
end
node--Chain Events-->cs
qser-.Protocol TBD.->qport
sser--Protocol TBD-->sport
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've put together a high-level and rough diagram of the possible components of the "follower" replacement in the Marlowe Runtime. Here is the diagram:
Interpreting the diagram:
Here is a summary of the components:
Chain Sync Client
This component connects to the local node and handles the stream of events that it sends. Its role is to classify the raw transactions and decide if they are relevant to the Marlowe Runtime. Conceptually, it can be thought of as a function:
Where ChainEvent can be a roll forward or roll backward message, and MarloweChainEvent is a filtered version of the ChainEvent that contains only the information we care about.
The chain sync client pushes the resulting Marlowe Chain Events to its outbox.
History Processor
This component receives a stream of Marlowe Chain Events and converts them to History Events. Conceptually, it can be thought of as a function:
The history processor pushes the resulting History Events to its outbox.
History Store:
This component receives history events and exposes an API for querying them.
Contract Store:
This component receives history events and aggregates them into contract state aggregate roots. It exposes an API for querying contract state.
Streaming Server:
This component serves streaming content from the runtime. It is responsible for establishing streaming connections in response to client requests. When it receives a subscription, it fast forwards the subscriber by querying the history store for the history "so far". It then switches to the live updates from the History Processor, sending them out to the subscriber.
Query Server:
This component responds to queries. It queries the History Store and the contract store to do so.
Streaming API:
This component connects the Streaming Server to a concrete transport protocol (e.g. websockets via HTTP, ZeroMQ, etc.)
Query API:
This component connects the Query Server to a concrete transport protocol (e.g. HTTP, ZeroMQ, RPC, GraphQL, etc.)
MARLOWE_RT_NODE_SOCKET:
This is a reference / path to the local node's socket, held in the environment.
MARLOWE_RT_STREAMING_PORT:
This is a port number for the Streaming API to bind to, held in the environment.
MARLOWE_RT_QUERY_PORT:
This is a port number for the Query API to bind to, held in the environment.
Beta Was this translation helpful? Give feedback.
All reactions