The gateway role (§15): one address through which a fleet of instances is reached. Nodes attach here under a name, and a session opened on one of them is routed to it for as long as it lives — by the handle every tool call names, every task id begins with and every upload's path carries.
A node holds one request open, POST /gateway/attach, whose event
stream delivers what the gateway has for it: request envelopes, a ping
when its name is contested, a handle to drop. It answers a request with
POST /gateway/answer/<rid>, one for each write its handler makes,
which is answered only once those bytes are written to the waiting
client — so a write on the node succeeds or fails as it would on a
direct connection. A request body too large to ride the envelope is
fetched from /gateway/body/<rid>, in frames, so that one cut short on
its way in is never taken for a whole one.
The gateway persists nothing. Its routes are what nodes register as they mint and report as they attach and with every beat, so a gateway started again at the same address is told everything it needs by nodes redialling. Requests that name nothing routed are served by this JVM, exactly as on an instance alone.
The gateway role (§15): one address through which a fleet of instances is reached. Nodes attach here under a name, and a session opened on one of them is routed to it for as long as it lives — by the handle every tool call names, every task id begins with and every upload's path carries. A node holds one request open, `POST /gateway/attach`, whose event stream delivers what the gateway has for it: request envelopes, a ping when its name is contested, a handle to drop. It answers a request with `POST /gateway/answer/<rid>`, one for each write its handler makes, which is answered only once those bytes are written to the waiting client — so a write on the node succeeds or fails as it would on a direct connection. A request body too large to ride the envelope is fetched from `/gateway/body/<rid>`, in frames, so that one cut short on its way in is never taken for a whole one. The gateway persists nothing. Its routes are what nodes register as they mint and report as they attach and with every beat, so a gateway started again at the same address is told everything it needs by nodes redialling. Requests that name nothing routed are served by this JVM, exactly as on an instance alone.
(await-change seen)A task settling with the roster once the fleet is other than seen, a
roster given earlier — at once when it already is. With nil, other
than it is at the call. A change is a node attaching, going away or
being forgotten, or its name passing to another attachment
(membership). It fails when the gateway stops first, as a wait for a
node does.
Compared and left waiting in one step, under the lock the fleet is changed under: whatever changes it afterwards finds the wait.
A task settling with the roster once the fleet is other than `seen`, a roster given earlier — at once when it already is. With nil, other than it is at the call. A change is a node attaching, going away or being forgotten, or its name passing to another attachment (`membership`). It fails when the gateway stops first, as a wait for a node does. Compared and left waiting in one step, under the lock the fleet is changed under: whatever changes it afterwards finds the wait.
(await-node name)A task settling with name's roster line once a node of that name is
attached to this gateway — at once when it already is. It fails when
the gateway stops first, or has ended its run already: a wait is its
run's, and the gateway started next knows nothing of it.
Looked for and left waiting in one step, under the lock a node is admitted under, a welcome tells its waits under and a run is ended under: the node that attaches afterwards finds the wait, and a run that has ended is asked nothing.
A task settling with `name`'s roster line once a node of that name is attached to this gateway — at once when it already is. It fails when the gateway stops first, or has ended its run already: a wait is its run's, and the gateway started next knows nothing of it. Looked for and left waiting in one step, under the lock a node is admitted under, a welcome tells its waits under and a run is ended under: the node that attaches afterwards finds the wait, and a run that has ended is asked nothing.
The cadence both ends keep: the gateway writes at least a comment to each attach stream this often, and a node says it is alive this often.
The cadence both ends keep: the gateway writes at least a comment to each attach stream this often, and a node says it is alive this often.
(end!)End this gateway's run, while its port is still open: nobody joins it
from here on, nothing is routed by it or opened on it, and no wait is
left on it or told of a change. For before the port is closed, which
lets every node go: that is the gateway stopping, and no change to
its fleet. stop! does the rest. Safe when this is no gateway.
End this gateway's run, while its port is still open: nobody joins it from here on, nothing is routed by it or opened on it, and no wait is left on it or told of a change. For before the port is closed, which lets every node go: that is the gateway stopping, and no change to its fleet. `stop!` does the rest. Safe when this is no gateway.
How long a node may go unheard before it is taken for gone. A closed socket is noticed at once; sleep and a partition close nothing, and only silence shows them.
How long a node may go unheard before it is taken for gone. A closed socket is noticed at once; sleep and a partition close nothing, and only silence shows them.
(roster)The fleet as this gateway sees it now, as roster-of has it.
The fleet as this gateway sees it now, as `roster-of` has it.
(start!)Make this instance a gateway: handles are minted against the whole
fleet from here on. Returns what the transport is to be started with,
{:route fn, :contexts {path fn}, :fleet hooks} — the router, the
nodes' door and the claim of the run that starts here, which stay
that run's for as long as the server holding them serves anything.
Before the port opens.
Make this instance a gateway: handles are minted against the whole
fleet from here on. Returns what the transport is to be started with,
`{:route fn, :contexts {path fn}, :fleet hooks}` — the router, the
nodes' door and the claim of the run that starts here, which stay
that run's for as long as the server holding them serves anything.
Before the port opens.(stop!)End this gateway's run and let every node go. Its routes go with it: a gateway started again is told them afresh. A request the run's transport accepted and has not yet routed is refused when its turn comes: never served here, and never carried to a node of a later run. Whoever waits for a node, or for a change to the fleet, is told the gateway stopped.
End this gateway's run and let every node go. Its routes go with it: a gateway started again is told them afresh. A request the run's transport accepted and has not yet routed is refused when its turn comes: never served here, and never carried to a node of a later run. Whoever waits for a node, or for a change to the fleet, is told the gateway stopped.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |