Skip to content

Instantly share code, notes, and snippets.

@belisarius222
Created August 18, 2022 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save belisarius222/c4f73d18729d4f6528d2834c375db02d to your computer and use it in GitHub Desktop.
Save belisarius222/c4f73d18729d4f6528d2834c375db02d to your computer and use it in GitHub Desktop.
proposed gall with no request queue
I just realized we should be able to delete gall's outstanding request queue entirely -- but we probably don't want to do that now, since the migration might be hairy
we could do this now because pokes and watches can never share the same flow
so there's no need for gall to maintain state to disambiguate them
we would need to collapse the foreign sending down to a single-step move, instead of a stack of two wires
so instead of gall passing a move to itself, then passing a move to ames,
gall would need to see the %watch, %leave, or %poke come out of the agent, then fire it off to ames with a wire that says whether it was a subscription or poke
a subscription wire would also need to say which foreign ship, agent, and path we're subscribing to (or unsubscribing from), and contain the subscription nonce
a poke wire would just need the foreign ship and wire the agent set, I believe
I'm not sure how we would migrate to this, especially for the poke case -- for subscriptions, we could potentially kill all existing subscriptions and let agents resubscribe using the new system, so that's easier
if we got a %done sign from ames on a subscription wire, we'd look up the local agent and subscription wire based on the wire in the move, and check the subscription's "acked" bit
if it's not acked yet, mark it as acked and call the agent's +on-agent with a %watch-ack
if it is acked, then something is wrong, since we shouldn't have sent a duplicate %watch
but we could ignore it
when the agent sends a %leave, then we immediately delete the subscription and send ames the %leave and a %cork right after it
so if we get an ack from ames on some subscription wire we don't remember, then no-op, since we know it was an ack for a %leave, and agents don't care if that gets nacked
(agents don't care because they're not told about this)
so this would be a quite simple state machine for a subscription wire
for a poke wire, we see that it's a poke wire, extract the part of the wire that the agent came up with, and use that to inject a %poke-ack in the agent's +on-agent arm
if the agent emitted three pokes in a row on the same wire, it'll have to remember which one meant what -- note that even with gall's request queue as it is now, that's already the case, so from the agent's perspective, that shouldn't be any different
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment