links-lang / links

Links: Linking Theory to Practice for the Web
http://www.links-lang.org
Other
318 stars 42 forks source link

Remove distributed session delegation in order to clean up proc.ml #1172

Closed SimonJF closed 1 year ago

SimonJF commented 1 year ago

Channels are not innately suited to distributed computation because of the 'distributed delegation' problem which arises when sending channels over channels: if we send endpoint A over endpoint B, then we don't know where to route any messages to endpoint A.

Before, there was a ton of complex code which may or may not have worked, which attempted to implement a version of the distributed delegation algorithm described in the original Session Java paper. This significantly complicated the distributed sessions runtime in proc.ml and jslib.js.

In practice, we only really delegate from server to client, which does not require any special treatment. None of our present code sends session endpoints from client to other client, or client to server. Therefore, all of this spaghetti code is actually redundant. This patch removes all the distributed delegation code and therefore vastly streamlines the distributed session runtime. Attempting to do distributed delegation from client to server, or client to other client, will now result in a runtime error.

In future we may want to re-enable a form of this. I think the easiest way of doing this would be to explicitly allow the creation of "remote channels" whose buffers reside on the server with sends / receives requiring a remote call -- we would then only need to do name passing.

SimonJF commented 1 year ago

This should address #1103 (got round to it eventually!)

SimonJF commented 1 year ago

@slindley Unless you have any objections, can this go in? I don't think it's too controversial.