ames: add scry endpoint for forward lane

Finds the lane for that peer, or their galaxy. Intended for use in the
runtime, to enable stateless forwarding.
This commit is contained in:
Fang 2020-07-03 00:51:54 +02:00
parent 31d776c50b
commit 92beeca9f0
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -701,14 +701,15 @@
=(%$ syd) =(%$ syd)
== ==
~ ~
:: /ax/protocol/version @ :: /ax/protocol/version @
:: /ax/peers (map ship ?(%alien known)) :: /ax/peers (map ship ?(%alien known))
:: /ax/peers/[ship] ship-state :: /ax/peers/[ship] ship-state
:: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)] :: /ax/peers/[ship]/forward-lane (unit lane)
:: /ax/snd-bones/[ship]/[bone] vase :: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)]
:: /ax/snd-bones/[ship]/[bone] vase
:: ::
?. ?=(%x ren) ~ ?. ?=(%x ren) ~
?+ tyl [~ ~] ?+ tyl ~
[%protocol %version ~] [%protocol %version ~]
``noun+!>(protocol-version) ``noun+!>(protocol-version)
:: ::
@ -717,12 +718,35 @@
!> ^- (map ship ?(%alien %known)) !> ^- (map ship ?(%alien %known))
(~(run by peers.ames-state) head) (~(run by peers.ames-state) head)
:: ::
[%peers @ ~] [%peers @ *]
=/ who (slaw %p i.t.tyl) =/ who (slaw %p i.t.tyl)
?~ who [~ ~] ?~ who [~ ~]
?~ peer=(~(get by peers.ames-state) u.who) ?~ peer=(~(get by peers.ames-state) u.who)
[~ ~] [~ ~]
``noun+!>(u.peer) ?+ t.t.tyl [~ ~]
~ ``noun+!>(u.peer)
::
[%forward-lane ~]
::TODO (list lane) instead?
::TODO refactor wrt +send-blob to share routing logic
:: find lane for u.who, or their galaxy
::
:^ ~ ~ %noun
!> ^- (unit lane)
=/ ship-state (~(get by peers.ames-state) u.who)
?. ?=([~ %known *] ship-state)
~
=/ peer-state +.u.ship-state
?. =(~ route.peer-state) ::NOTE avoid tmi
`lane:(need route.peer-state)
|- ^- (unit lane)
?: ?=(%czar (clan:title sponsor.peer-state))
`[%& sponsor.peer-state]
=/ next (~(get by peers.ames-state) sponsor.peer-state)
?. ?=([~ %known *] next)
~
$(peer-state +.u.next)
==
:: ::
[%bones @ ~] [%bones @ ~]
=/ who (slaw %p i.t.tyl) =/ who (slaw %p i.t.tyl)