mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 14:57:12 +03:00
wait to start sync until ship exists
This commit is contained in:
parent
186513b723
commit
407919b24a
@ -73,6 +73,6 @@
|
||||
%sav ~& [%save-file-to p.b] line
|
||||
%url ~& [%activate-url p.b] line
|
||||
==
|
||||
~& last-line
|
||||
~? !=(~ last-line) last-line
|
||||
this
|
||||
--
|
||||
|
@ -21,6 +21,8 @@
|
||||
:: We get ++unix-event and ++pill from /-aquarium
|
||||
::
|
||||
/- aquarium
|
||||
/+ pill
|
||||
=, pill-lib=pill
|
||||
=, aquarium
|
||||
=> $~ |%
|
||||
+$ move (pair bone card)
|
||||
@ -373,6 +375,14 @@
|
||||
=> .(this ^+(this this))
|
||||
=^ ms this (poke-pill pil)
|
||||
(emit-moves ms)
|
||||
::
|
||||
[%swap-files ~]
|
||||
=. userspace-ova.pil
|
||||
:_ ~
|
||||
%- unix-event
|
||||
(file-ovum:pill-lib /(scot %p our.hid)/home/(scot %da now.hid))
|
||||
=^ ms this (poke-pill pil)
|
||||
(emit-moves ms)
|
||||
::
|
||||
[%wish hers=* p=@t]
|
||||
%+ turn-ships ((list ship) hers.val)
|
||||
@ -461,7 +471,7 @@
|
||||
%event
|
||||
~? &(aqua-debug=| !?=(?(%belt %hear) -.q.ue.ae))
|
||||
raw-event=[who.ae -.q.ue.ae]
|
||||
~? &(debug=& ?=(%they -.q.ue.ae))
|
||||
~? &(debug=| ?=(%they -.q.ue.ae))
|
||||
raw-event=[who.ae ue.ae]
|
||||
(push-events:(pe who.ae) [ue.ae]~)
|
||||
==
|
||||
@ -513,15 +523,15 @@
|
||||
++ peek-x-i
|
||||
|= pax=path
|
||||
^- (unit (unit [%noun noun]))
|
||||
?. ?=([@ @ @ @ *] pax)
|
||||
?. ?=([@ @ @ @ @ *] pax)
|
||||
~
|
||||
=/ who (slav %p i.t.pax)
|
||||
=/ who (slav %p i.pax)
|
||||
=/ pier (~(get by piers) who)
|
||||
=/ ren i.t.t.t.pax
|
||||
=/ ren i.t.t.t.t.pax
|
||||
?~ pier
|
||||
~
|
||||
:^ ~ ~ %noun
|
||||
(peek:(pe who) pax)
|
||||
(peek:(pe who) t.pax)
|
||||
::
|
||||
:: Get all created ships
|
||||
::
|
||||
|
@ -202,5 +202,6 @@
|
||||
++ reap-drum-phat (wrap reap-phat):from-drum
|
||||
++ woot-helm (wrap take-woot):from-helm
|
||||
++ writ-kiln-autoload (wrap take-writ-autoload):from-kiln
|
||||
++ writ-kiln-find-ship (wrap take-writ-find-ship):from-kiln
|
||||
++ writ-kiln-sync (wrap take-writ-sync):from-kiln
|
||||
--
|
||||
|
30
app/ph.hoon
30
app/ph.hoon
@ -142,8 +142,8 @@
|
||||
router:eth-node
|
||||
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
|
||||
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
|
||||
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~marbud))
|
||||
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~mardev))
|
||||
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
|
||||
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
|
||||
(send-hi ~marbud ~mardev)
|
||||
;< eth-node=_eth-node bind:m
|
||||
(breach-and-hear:eth-node our.hid ~mardev ~marbud)
|
||||
@ -152,7 +152,31 @@
|
||||
router:eth-node
|
||||
;< ~ bind:m (send-hi-not-responding ~marbud ~mardev)
|
||||
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
|
||||
(wait-for-dojo ~bud "hi ~mardev successful")
|
||||
(wait-for-dojo ~marbud "hi ~mardev successful")
|
||||
(pure:m ~)
|
||||
::
|
||||
:+ %breach-sync
|
||||
~[~bud ~dev]
|
||||
=. eth-node (spawn:eth-node ~dev)
|
||||
;< [eth-node=_eth-node ~] bind:m
|
||||
%+ (wrap-philter ,_eth-node ,~)
|
||||
router:eth-node
|
||||
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
|
||||
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
|
||||
;< ~ bind:m (just-events (dojo ~bud "|sync %base ~dev %kids"))
|
||||
;< file=@t bind:m (touch-file ~dev %base)
|
||||
(check-file-touched ~bud %home file)
|
||||
:: ;< ~ bind:m (check-file-touched ~bud %home file)
|
||||
:: (just-events (dojo ~bud "|verb"))
|
||||
;< eth-node=_eth-node bind:m
|
||||
(breach-and-hear:eth-node our.hid ~dev ~bud)
|
||||
;< [eth-node=_eth-node ~] bind:m
|
||||
%+ (wrap-philter ,_eth-node ,~)
|
||||
router:eth-node
|
||||
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
|
||||
;< file=@t bind:m (touch-file ~dev %base)
|
||||
;< file=@t bind:m (touch-file ~dev %base)
|
||||
(check-file-touched ~bud %home file)
|
||||
(pure:m ~)
|
||||
==
|
||||
::
|
||||
|
10
gen/aqua/scry.hoon
Normal file
10
gen/aqua/scry.hoon
Normal file
@ -0,0 +1,10 @@
|
||||
/- aquarium
|
||||
/+ ph-util
|
||||
=, aquarium
|
||||
:- %say
|
||||
|* $: [now=@da eny=@uvJ bec=beak]
|
||||
[a=mold pax=path ~]
|
||||
~
|
||||
==
|
||||
:- %noun
|
||||
(scry-aqua:ph-util a p.bec now pax)
|
@ -320,6 +320,16 @@
|
||||
==
|
||||
abet:abet:(mere:(auto hos) mes)
|
||||
::
|
||||
++ take-writ-find-ship ::
|
||||
|= {way/wire rot/riot}
|
||||
?> ?=({@ @ @ *} way)
|
||||
=+ ^- hos/kiln-sync
|
||||
:* syd=(slav %tas i.way)
|
||||
her=(slav %p i.t.way)
|
||||
sud=(slav %tas i.t.t.way)
|
||||
==
|
||||
abet:abet:(take-find-ship:(auto hos) rot)
|
||||
::
|
||||
++ take-writ-sync ::
|
||||
|= {way/wire rot/riot}
|
||||
?> ?=({@ @ @ *} way)
|
||||
@ -379,7 +389,13 @@
|
||||
(blab [ost %warp wire her sud `[%sing %y ud+let /]] ~)
|
||||
::
|
||||
++ start-sync
|
||||
=< (spam (render "activated sync" sud her syd) ~)
|
||||
=> (spam (render "finding ship and desk" sud her syd) ~)
|
||||
=/ =wire /kiln/find-ship/[syd]/(scot %p her)/[sud]
|
||||
(blab [ost %warp wire her sud `[%sing %y ud+2 /]] ~)
|
||||
::
|
||||
++ take-find-ship
|
||||
|= rot=riot
|
||||
=> (spam (render "activated {<rot>} sync" sud her syd) ~)
|
||||
=/ =wire /kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
(blab [ost %warp wire her sud `[%sing %w [%da now] /]] ~)
|
||||
::
|
||||
@ -392,7 +408,9 @@
|
||||
(render "on sync" sud her syd)
|
||||
~
|
||||
start-sync
|
||||
~& kiln-writ-let-a=let
|
||||
=. let ?. ?=($w p.p.u.rot) let ud:((hard cass:clay) q.q.r.u.rot)
|
||||
~& kiln-writ-let-b=let
|
||||
=/ =wire /kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
:: germ: merge mode for sync merges
|
||||
::
|
||||
|
@ -248,7 +248,9 @@
|
||||
^+ *form:(ph ,~)
|
||||
|= pin=ph-input
|
||||
:+ & ~
|
||||
=/ aqua-pax /i/j/(scot %p her)/life/(scot %da now.pin)/(scot %p who)/noun
|
||||
=/ aqua-pax
|
||||
:- %i
|
||||
/(scot %p her)/j/(scot %p her)/life/(scot %da now.pin)/(scot %p who)/noun
|
||||
=/ lyfe (scry-aqua noun our now.pin aqua-pax)
|
||||
~& [new-lyfe=[0 new-lyfe] lyfe=lyfe]
|
||||
?: =([~ new-lyfe] lyfe)
|
||||
@ -286,7 +288,9 @@
|
||||
^+ *form:(ph ,~)
|
||||
|= pin=ph-input
|
||||
:+ & ~
|
||||
=/ aqua-pax /i/j/(scot %p her)/rift/(scot %da now.pin)/(scot %p who)/noun
|
||||
=/ aqua-pax
|
||||
:- %i
|
||||
/(scot %p her)/j/(scot %p her)/rift/(scot %da now.pin)/(scot %p who)/noun
|
||||
=/ rut (scry-aqua noun our now.pin aqua-pax)
|
||||
?: =([~ new-rut] rut)
|
||||
[%done ~]
|
||||
|
@ -142,7 +142,16 @@
|
||||
|= pin=ph-input
|
||||
=/ host-pax
|
||||
/(scot %p our)/home/(scot %da now.pin)/sur/aquarium/hoon
|
||||
=/ warped (cat 3 '=> . ' .^(@t %cx host-pax))
|
||||
=/ pax /sur/aquarium/hoon
|
||||
=/ aqua-pax
|
||||
;: weld
|
||||
/i/(scot %p her)/cx/(scot %p her)/[des]/(scot %da now.pin)
|
||||
pax
|
||||
/noun
|
||||
==
|
||||
=/ warped
|
||||
%^ cat 3 '=> . '
|
||||
(need (scry-aqua (unit @) our now.pin aqua-pax))
|
||||
[& (insert-file her des host-pax warped) %done warped]
|
||||
::
|
||||
:: Check /sur/aquarium/hoon on the given has the given contents.
|
||||
@ -150,15 +159,16 @@
|
||||
++ check-file-touched
|
||||
|= [her=ship des=desk warped=@t]
|
||||
=/ m (ph ,~)
|
||||
;< ~ bind:m (mount her des)
|
||||
^- form:m
|
||||
|= pin=ph-input
|
||||
?. &(=(her who.pin) ?=(?(%init %ergo) -.q.uf.pin))
|
||||
[& ~ %wait ~]
|
||||
=/ pax /home/(scot %da now.pin)/sur/aquarium/hoon
|
||||
=/ pax /sur/aquarium/hoon
|
||||
=/ aqua-pax
|
||||
;: weld
|
||||
/i/cx/(scot %p her)
|
||||
pax(- des)
|
||||
/i/(scot %p her)/cx/(scot %p her)/[des]/(scot %da now.pin)
|
||||
pax
|
||||
/noun
|
||||
==
|
||||
?: =(warped (need (scry-aqua (unit @) our now.pin aqua-pax)))
|
||||
|
@ -498,7 +498,6 @@
|
||||
:: +rift-scry: for a +rift
|
||||
::
|
||||
++ rift-scry
|
||||
~/ %rift-scry
|
||||
|= who=ship
|
||||
^- (unit rift)
|
||||
=; rit
|
||||
@ -3965,8 +3964,8 @@
|
||||
::
|
||||
:: Don't clear state, because it doesn't quite work yet.
|
||||
::
|
||||
?: =(0 0)
|
||||
`..^$
|
||||
:: ?: =(0 0)
|
||||
:: `..^$
|
||||
:: if we sunk, don't clear clay
|
||||
::
|
||||
?: =(our p.req)
|
||||
|
@ -1445,6 +1445,7 @@
|
||||
net:(fall (~(get by pos.eth) who) *point)
|
||||
*[life pass continuity-number=@ud [? @p] (unit @p)]
|
||||
%+ weld
|
||||
%- flop
|
||||
^- (list move)
|
||||
:~ [hen %slip %a %sunk who rit]
|
||||
[hen %slip %c %sunk who rit]
|
||||
|
Loading…
Reference in New Issue
Block a user