mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 03:14:30 +03:00
khan: cleanup
This commit is contained in:
parent
12b4c80cf1
commit
8ad57d8bd2
@ -2098,13 +2098,13 @@
|
|||||||
++ khan ^?
|
++ khan ^?
|
||||||
|%
|
|%
|
||||||
+$ gift :: out result <-$
|
+$ gift :: out result <-$
|
||||||
$% [%avow p=(each cage [term tang])] :: thread result
|
$% [%avow p=(each [mark noun] [term tang])] :: thread result
|
||||||
==
|
==
|
||||||
+$ task :: in request ->$
|
+$ task :: in request ->$
|
||||||
$~ [%vega ~]
|
$~ [%vega ~]
|
||||||
$% $>(%born vane-task) :: new unix process
|
$% $>(%born vane-task) :: new unix process
|
||||||
[%done ~] :: socket closed
|
[%done ~] :: socket closed
|
||||||
[%fyrd =beak name=term data=*] :: run thread v0
|
[%fyrd =desk name=term data=*] :: run thread v0
|
||||||
$>(%trim vane-task) :: trim state
|
$>(%trim vane-task) :: trim state
|
||||||
$>(%vega vane-task) :: report upgrade
|
$>(%vega vane-task) :: report upgrade
|
||||||
==
|
==
|
||||||
|
@ -49,27 +49,33 @@
|
|||||||
^- [(list move) _khan-gate]
|
^- [(list move) _khan-gate]
|
||||||
::
|
::
|
||||||
=/ =task:khan ((harden task:khan) wrapped-task)
|
=/ =task:khan ((harden task:khan) wrapped-task)
|
||||||
?- -.task
|
?+ -.task [~ khan-gate]
|
||||||
%vega
|
|
||||||
[~ khan-gate]
|
|
||||||
%trim
|
|
||||||
[~ khan-gate]
|
|
||||||
%done
|
|
||||||
[~ khan-gate]
|
|
||||||
%born
|
%born
|
||||||
[~ khan-gate(unix-duct hen)]
|
[~ khan-gate(unix-duct hen)]
|
||||||
%fyrd
|
%fyrd
|
||||||
=/ rid=@ta (rear (head hen))
|
:: start the thread on %spider.
|
||||||
|
::
|
||||||
|
=/ wir=wire (head hen)
|
||||||
|
=/ rid=@ta (rear wir)
|
||||||
|
:: XX what if the client sends a duplicate rid?
|
||||||
|
:: is this fine? should we inject some randomness?
|
||||||
|
::
|
||||||
=/ tid=@ta
|
=/ tid=@ta
|
||||||
(cat 3 'khan-fyrd--' rid)
|
(cat 3 'khan-fyrd--' rid)
|
||||||
=/ args
|
=/ args
|
||||||
:* ~ `tid [our q.beak.task %da now] name.task
|
:* ~ `tid [our desk.task %da now] name.task
|
||||||
!>([~ ~zod])
|
:: XX can't do this:
|
||||||
|
::
|
||||||
|
:: !>(data.task)
|
||||||
|
::
|
||||||
|
:: special case for -hi:
|
||||||
|
::
|
||||||
|
!>(;;([~ arg=$@(who=ship [who=ship mez=tape])] data.task))
|
||||||
==
|
==
|
||||||
=/ start-moves=(list move)
|
=/ start-moves=(list move)
|
||||||
%+ turn
|
%+ turn
|
||||||
:~ (watch-spider p.beak.task /thread-result/[tid])
|
:~ (watch-spider our /thread-result/[tid])
|
||||||
(start-spider p.beak.task %spider-start !>(args))
|
(start-spider our %spider-start !>(args))
|
||||||
==
|
==
|
||||||
|=(=note ^-(move [hen %pass //g note]))
|
|=(=note ^-(move [hen %pass //g note]))
|
||||||
[start-moves khan-gate]
|
[start-moves khan-gate]
|
||||||
@ -80,7 +86,7 @@
|
|||||||
|= old=khan-state
|
|= old=khan-state
|
||||||
^+ khan-gate
|
^+ khan-gate
|
||||||
khan-gate(state old)
|
khan-gate(state old)
|
||||||
:: +scry: view khan state
|
:: +scry: nothing to see as yet
|
||||||
::
|
::
|
||||||
++ scry
|
++ scry
|
||||||
^- roon
|
^- roon
|
||||||
@ -88,6 +94,8 @@
|
|||||||
^- (unit (unit cage))
|
^- (unit (unit cage))
|
||||||
~
|
~
|
||||||
++ stay state
|
++ stay state
|
||||||
|
:: +take: handle responses.
|
||||||
|
::
|
||||||
++ take
|
++ take
|
||||||
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
|
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
|
||||||
^- [(list move) _khan-gate]
|
^- [(list move) _khan-gate]
|
||||||
@ -100,24 +108,30 @@
|
|||||||
?(%poke-ack %watch-ack)
|
?(%poke-ack %watch-ack)
|
||||||
?~ p.p.hin [~ khan-gate]
|
?~ p.p.hin [~ khan-gate]
|
||||||
%- (slog u.p.p.hin)
|
%- (slog u.p.p.hin)
|
||||||
[~ khan-gate]
|
:_ khan-gate
|
||||||
|
[hen %give %avow %| -.p.hin u.p.p.hin]~
|
||||||
::
|
::
|
||||||
%fact
|
%fact
|
||||||
=* cag cage.p.hin
|
=* cag cage.p.hin
|
||||||
?+ p.cag !!
|
?+ p.cag ~&(bad-fact+p.cag !!)
|
||||||
%thread-fail
|
%thread-fail
|
||||||
%- (slog !<(tang q.cag))
|
=/ =tang !<(tang q.cag)
|
||||||
[~ khan-gate]
|
%- (slog tang)
|
||||||
|
:_ khan-gate
|
||||||
|
[hen %give %avow %| p.cag tang]~
|
||||||
::
|
::
|
||||||
%thread-done
|
%thread-done
|
||||||
:_ khan-gate
|
:_ khan-gate
|
||||||
=/ mov=move
|
:: XX mark conversion
|
||||||
[hen %give %avow %& %tape !>(~)]
|
::
|
||||||
~[mov]
|
=/ res=* !<(* q.cag)
|
||||||
|
[hen %give %avow %& %noun res]~
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%khan
|
%khan
|
||||||
|
:: XX unreachable?
|
||||||
|
::
|
||||||
!!
|
!!
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user