mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-09-21 23:47:35 +03:00
refactors binding and acknowledgment pokes
This commit is contained in:
parent
ba614f3f72
commit
f801776bac
98
app/dns.hoon
98
app/dns.hoon
@ -3,8 +3,8 @@
|
|||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
+= move (pair bone card)
|
+= move (pair bone card)
|
||||||
+= poke $% [%dns-bind ship target]
|
+= poke $% [%dns-bind for=ship him=ship target]
|
||||||
[%dns-bound ship ship turf]
|
[%dns-bond for=ship him=ship turf]
|
||||||
==
|
==
|
||||||
+= card $% [%tend wire ~]
|
+= card $% [%tend wire ~]
|
||||||
[%poke wire dock poke]
|
[%poke wire dock poke]
|
||||||
@ -59,6 +59,7 @@
|
|||||||
$: wen=@da
|
$: wen=@da
|
||||||
wer=(unit @if)
|
wer=(unit @if)
|
||||||
bon=?
|
bon=?
|
||||||
|
tar=target
|
||||||
==
|
==
|
||||||
:: +state: complete app state
|
:: +state: complete app state
|
||||||
::
|
::
|
||||||
@ -92,13 +93,18 @@
|
|||||||
abet:(init:bind aut)
|
abet:(init:bind aut)
|
||||||
::
|
::
|
||||||
++ poke-dns-bind :: bind or forward
|
++ poke-dns-bind :: bind or forward
|
||||||
|= [him=ship tar=target]
|
|= [for=ship him=ship tar=target]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
~& [%bind src=src.bow him=him tar=tar]
|
~& [%bind src=src.bow him=him tar=tar]
|
||||||
?: ?=(^ nem)
|
=^ zom=(list move) ..this
|
||||||
:: XX bind & forward?
|
^- (quip move _this)
|
||||||
|
abet:(~(forward tell him ~) tar)
|
||||||
|
?~ nem
|
||||||
|
[zom this]
|
||||||
|
:: XX =^ nest-fail
|
||||||
|
=/ zam=(quip move _this)
|
||||||
abet:(~(create bind u.nem) him tar)
|
abet:(~(create bind u.nem) him tar)
|
||||||
abet:(~(forward tell him ~) tar)
|
[(weld zom -.zam) +.zam]
|
||||||
::
|
::
|
||||||
:: ++ coup-dns-bind :: retry?
|
:: ++ coup-dns-bind :: retry?
|
||||||
:: |= [wir=wire saw=(unit tang)]
|
:: |= [wir=wire saw=(unit tang)]
|
||||||
@ -112,14 +118,22 @@
|
|||||||
:: * ~&(coup-dns-bind+wir [~ this])
|
:: * ~&(coup-dns-bind+wir [~ this])
|
||||||
:: ==
|
:: ==
|
||||||
::
|
::
|
||||||
++ poke-dns-bound :: confirm or forward
|
++ poke-dns-bond :: confirm or forward
|
||||||
|= [him=ship for=ship dom=turf]
|
|= [for=ship him=ship dom=turf]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
|
?< =(for him)
|
||||||
~& [%bound +<]
|
~& [%bound +<]
|
||||||
?. =(our.bow for)
|
?: =(our.bow him)
|
||||||
abet:(backward:tell him for dom)
|
:: XX notify eyre/hood/acme etc
|
||||||
=< abet
|
~& [%bound-us dom]
|
||||||
(~(bake tell [him (~(get by per) him)]) dom)
|
:- ~
|
||||||
|
this(dom (~(put in ^dom) dom))
|
||||||
|
?: =(our.bow for)
|
||||||
|
~& [%bound-him him dom]
|
||||||
|
=< abet
|
||||||
|
(~(bake tell [him (~(get by per) him)]) dom)
|
||||||
|
~& [%strange-bond +<]
|
||||||
|
[~ this]
|
||||||
::
|
::
|
||||||
++ rove :: hear lane change
|
++ rove :: hear lane change
|
||||||
|= [wir=wire p=ship q=lane:ames]
|
|= [wir=wire p=ship q=lane:ames]
|
||||||
@ -152,6 +166,11 @@
|
|||||||
^- (quip move _^this)
|
^- (quip move _^this)
|
||||||
[(flop moz) ^this(nem `nam)]
|
[(flop moz) ^this(nem `nam)]
|
||||||
::
|
::
|
||||||
|
++ emit
|
||||||
|
|= a=card
|
||||||
|
^+ this
|
||||||
|
this(moz [[ost.bow a] moz])
|
||||||
|
::
|
||||||
++ init
|
++ init
|
||||||
|= aut=authority
|
|= aut=authority
|
||||||
:: XX confirm credentials
|
:: XX confirm credentials
|
||||||
@ -160,7 +179,13 @@
|
|||||||
::
|
::
|
||||||
++ create
|
++ create
|
||||||
|= [him=ship tar=target]
|
|= [him=ship tar=target]
|
||||||
this :: XX
|
=| for=@p :: XX
|
||||||
|
%- emit
|
||||||
|
:* %poke
|
||||||
|
/foward/bound/(scot %p him)/for/(scot %p for)
|
||||||
|
[for %dns]
|
||||||
|
[%dns-bond him for *turf]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ confirm
|
++ confirm
|
||||||
|= him=ship
|
|= him=ship
|
||||||
@ -193,16 +218,25 @@
|
|||||||
++ rove :: hear
|
++ rove :: hear
|
||||||
|= lan=lane:ames
|
|= lan=lane:ames
|
||||||
^+ this
|
^+ this
|
||||||
=/ ip=(unit @if)
|
=/ adr=(unit @if)
|
||||||
?.(?=([%if *] lan) ~ `r.lan)
|
?.(?=([%if *] lan) ~ `r.lan)
|
||||||
=. rel `[now.bow ip |]
|
=/ tar=target
|
||||||
%- emit
|
?: ?| ?=(~ adr)
|
||||||
:* %poke
|
?=(%duke (clan:title him))
|
||||||
/bind/(scot %p him)/for/(scot %p our.bow)
|
==
|
||||||
[(sein:title our.bow) %dns]
|
[%indirect our.bow]
|
||||||
%dns-bind
|
[%direct %if u.adr]
|
||||||
[him ?~(ip [%indirect our.bow] [%direct %if u.ip])]
|
=/ ler=relay
|
||||||
==
|
[now.bow adr | tar]
|
||||||
|
?. ?| ?=(~ rel)
|
||||||
|
!=(tar tar.u.rel)
|
||||||
|
==
|
||||||
|
this
|
||||||
|
:: we may be an authority, so we poke ourselves
|
||||||
|
=/ wir=wire
|
||||||
|
/bind/(scot %p him)/for/(scot %p our.bow)
|
||||||
|
%- emit(rel `ler)
|
||||||
|
[%poke wir [our.bow %dns] %dns-bind our.bow him tar]
|
||||||
::
|
::
|
||||||
++ bake :: bound
|
++ bake :: bound
|
||||||
|= dom=turf
|
|= dom=turf
|
||||||
@ -224,21 +258,9 @@
|
|||||||
%czar ~zod
|
%czar ~zod
|
||||||
* (sein:title our.bow)
|
* (sein:title our.bow)
|
||||||
==
|
==
|
||||||
%- emit
|
=/ wir=wire
|
||||||
:* %poke
|
/forward/bind/(scot %p him)/for/(scot %p src.bow)
|
||||||
/foward/bind/(scot %p him)/for/(scot %p src.bow)
|
%- emit :: XX for
|
||||||
[to %dns]
|
[%poke wir [to %dns] %dns-bind src.bow him tar]
|
||||||
[%dns-bind him tar]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ backward :: relay binding ack
|
|
||||||
|= [him=ship for=ship dom=turf]
|
|
||||||
^+ this
|
|
||||||
%- emit
|
|
||||||
:* %poke
|
|
||||||
/foward/bound/(scot %p him)/for/(scot %p for)
|
|
||||||
[for %dns]
|
|
||||||
[%dns-bound him for dom]
|
|
||||||
==
|
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user