Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Aquarium and pH #1120

Merged
merged 62 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
fc9cae6
add userspace vere app
philipcmonk Jan 16, 2019
fe02c76
clear clay state and ford cache when hear sunk
philipcmonk Jan 31, 2019
0757005
WIP
philipcmonk Feb 1, 2019
88579c5
here updates
philipcmonk Feb 1, 2019
c6cf690
Merge branch 'tmp' into philip/here
philipcmonk Feb 1, 2019
6138daf
aquarium boots a fleet
philipcmonk Feb 2, 2019
54a6187
comments
philipcmonk Feb 2, 2019
ea27465
add outgoing http support and proper restoring
philipcmonk Feb 4, 2019
fd5df26
resurrect peek and wish
philipcmonk Feb 4, 2019
81e8c59
implement barebones clay file injection
philipcmonk Feb 5, 2019
da5515b
first integration test
philipcmonk Feb 6, 2019
1cfea70
hoist moves into variable
philipcmonk Feb 8, 2019
39ce138
test-hi works
philipcmonk Feb 8, 2019
705a531
add init cache to aqua for faster boot times
philipcmonk Feb 8, 2019
1a87a5c
add a little state to tests
philipcmonk Feb 8, 2019
64b1176
WIP merge
philipcmonk Feb 8, 2019
462f027
Merge remote-tracking branch 'origin/master' into philip/aquarium
philipcmonk Feb 8, 2019
0fc7ab1
modify behn to not fire in the middle of another event and take one t…
philipcmonk Feb 9, 2019
da12f04
WIP
philipcmonk Feb 9, 2019
17cea6a
better child-sync test
philipcmonk Feb 11, 2019
600dc02
basic ph test composition
philipcmonk Feb 11, 2019
11adf30
more modular test headstarts
philipcmonk Feb 11, 2019
3336699
most of proper cache restoration
philipcmonk Feb 12, 2019
42d5c90
small fixes and docs
philipcmonk Feb 12, 2019
6337c91
no barcabs anymore
philipcmonk Feb 13, 2019
7f8e3da
add test for changing a file
philipcmonk Feb 15, 2019
c3faca0
factor out ++touch-file
philipcmonk Feb 15, 2019
c4f3614
various fixes, add ++check-file-touched
philipcmonk Feb 16, 2019
ad4750f
add swap-vanes to aqua
philipcmonk Feb 21, 2019
3e1d742
add control flow to |verb
philipcmonk Feb 21, 2019
99b6111
wip
philipcmonk Feb 21, 2019
e319df9
trigger dill init on merge completion
philipcmonk Feb 22, 2019
3f74d30
add ford printf in bad situation
philipcmonk Feb 22, 2019
e22eac6
child-sync test passes
philipcmonk Feb 22, 2019
55b708d
Merge remote-tracking branch 'origin/next' into philip/aquarium
philipcmonk Feb 23, 2019
1ab6fea
keep logs
philipcmonk Mar 6, 2019
68d3ebd
remove init-cache
philipcmonk Mar 6, 2019
186984f
style
philipcmonk Mar 6, 2019
dab83cd
restructure to separate vane apps
philipcmonk Mar 7, 2019
ae8966e
compiles
philipcmonk Mar 8, 2019
1e1bcfa
Merge remote-tracking branch 'origin/master' into philip/aquarium
philipcmonk Mar 8, 2019
e261983
clean up printfs
philipcmonk Mar 8, 2019
187aff9
working after rearchitecture
philipcmonk Mar 8, 2019
c2c2b04
better init for ph
philipcmonk Mar 8, 2019
1893443
unclog gall queue
philipcmonk Mar 13, 2019
3d64641
make gen/aqua/file compile
philipcmonk Mar 13, 2019
aba5339
cleanup
philipcmonk Mar 20, 2019
4fc3f63
move test cores into the iron age
philipcmonk Mar 20, 2019
0dc6e69
cleanup
philipcmonk Mar 20, 2019
e8c7c16
add test queue and result summary
philipcmonk Mar 21, 2019
7edcbf7
add ability to cancel test
philipcmonk Mar 21, 2019
b5414a4
Merge remote-tracking branch 'origin/next' into philip/aquarium
philipcmonk Mar 21, 2019
154a726
clean and doc
philipcmonk Mar 23, 2019
8ebe809
disable clay sunk handling
philipcmonk Mar 23, 2019
3fcd17b
small improvements
philipcmonk Mar 23, 2019
19cb571
Add a readme
Fang- Mar 25, 2019
98ef8fa
Add minimal contributing section to readme
Fang- Mar 25, 2019
da883a5
Add simple .md mark
Fang- Mar 25, 2019
04b71f2
Merge pull request #1121 from urbit/readme
Fang- Mar 26, 2019
73febd4
Merge remote-tracking branch 'origin/master' into philip/aquarium
philipcmonk Mar 27, 2019
3c92eb5
fix review comments
philipcmonk Mar 29, 2019
7590a4f
add aqua to ci
philipcmonk Mar 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions app/aqua-ames.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
:: This needs a better SDN solution. Every ship should have an IP
:: address, and we should eventually test changing those IP
:: addresses.
::
:: For now, we broadcast every packet to every ship and rely on them
:: to drop them.
::
/- aquarium
=, aquarium
=> $~ |%
philipcmonk marked this conversation as resolved.
Show resolved Hide resolved
+$ move (pair bone card)
+$ card
$% [%poke wire dock %aqua-events (list aqua-event)]
[%peer wire dock path]
[%pull wire dock ~]
==
::
+$ state
$: %0
subscribed=_|
==
--
=, gall
=| moves=(list move)
=| aqua-event-list=(list aqua-event)
=| ships=(list ship)
|_ $: bowl
state
==
++ this .
++ apex %_(this moves ~, aqua-event-list ~, ships ~)
++ abet
=? this !=(~ aqua-event-list)
%- emit-moves
[ost %poke /aqua-events [our %aqua] %aqua-events aqua-event-list]~
:: ~? !?=(~ moves) [%aqua-ames-moves (lent moves)]
[moves this]
::
++ emit-moves
|= ms=(list move)
%_(this moves (weld moves ms))
::
++ emit-aqua-events
|= aes=(list aqua-event)
%_(this aqua-event-list (weld aqua-event-list aes))
::
++ poke-aqua-vane-control
|= command=?(%subscribe %unsubscribe)
:_ this(subscribed =(command %subscribe))
(aqua-vane-control-handler our ost subscribed command)
::
++ diff-aqua-effects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little comment explaining that this ignores effects other than %restore or %send might be helpful.

|= [way=wire afs=aqua-effects]
^- (quip move _this)
=. this apex =< abet
|- ^+ this
?~ ufs.afs
this
=. this
?+ -.q.i.ufs.afs this
%restore (handle-restore who.afs)
%send (handle-send i.ufs.afs)
==
$(ufs.afs t.ufs.afs)
::
++ handle-restore
|= who=@p
%- emit-aqua-events
[%event who [//newt/0v1n.2m9vh %barn ~]]~
::
++ handle-send
|= [way=wire %send lan=lane:ames pac=@]
^+ this
=/ hear [//newt/0v1n.2m9vh %hear lan pac]
=? ships =(~ ships)
.^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun)
%- emit-aqua-events
%+ turn ships
|= who=ship
[%event who hear]
--
126 changes: 126 additions & 0 deletions app/aqua-behn.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/- aquarium
=, aquarium
=> $~ |%
+$ move (pair bone card)
+$ card
$% [%poke wire dock %aqua-events (list aqua-event)]
[%peer wire dock path]
[%pull wire dock ~]
[%wait wire p=@da]
[%rest wire p=@da]
==
::
+$ state
$: %0
subscribed=_|
piers=(map ship pier)
==
::
+$ pier next-timer=(unit @da)
--
=, gall
=| moves=(list move)
|_ $: bowl
state
==
++ this .
++ apex %_(this moves ~)
++ abet [(flop moves) this]
++ emit-moves
|= ms=(list move)
%_(this moves (weld ms moves))
::
++ emit-aqua-events
|= aes=(list aqua-event)
%- emit-moves
[ost %poke /aqua-events [our %aqua] %aqua-events aes]~
::
++ poke-aqua-vane-control
|= command=?(%subscribe %unsubscribe)
:_ this(subscribed =(command %subscribe))
(aqua-vane-control-handler our ost subscribed command)
::
++ diff-aqua-effects
|= [way=wire afs=aqua-effects]
^- (quip move _this)
=. this apex =< abet
|- ^+ this
?~ ufs.afs
this
=. this
?+ -.q.i.ufs.afs this
%sleep abet-pe:handle-sleep:(pe who.afs)
%restore abet-pe:handle-restore:(pe who.afs)
%doze abet-pe:(handle-doze:(pe who.afs) i.ufs.afs)
==
$(ufs.afs t.ufs.afs)
::
:: Received timer wake
::
++ wake
|= [way=wire ~]
^- (quip move _this)
=. this apex =< abet
?> ?=([@ *] way)
=/ who (,@p (slav %p i.way))
abet-pe:(take-wake:(pe who) t.way ~)
::
++ pe
|= who=ship
=+ (fall (~(get by piers) who) *pier)
=* pier-data -
|%
++ abet-pe
^+ this
=. piers (~(put by piers) who pier-data)
this
::
++ handle-sleep
^+ ..abet-pe
=< ..abet-pe(pier-data *pier)
?~ next-timer
..abet-pe
cancel-timer
::
++ handle-restore
^+ ..abet-pe
=. this
%- emit-aqua-events
[%event who [//behn/0v1n.2m9vh %born ~]]~
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be the same /0v1n.2m9vh as in the ames handler? Maybe that constant should be split off into sur/aquarium/hoon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That value is u3A->sen, the "instance number" in vere. It's set to (scot %uv (mug now)) on boot/restart. I think the idea is to ensure there's a new duct corresponding to the new process, but it's not used for effect routing (or for injecting %wake events). I don't think it's needed here. It might not be needed at all, but that's a larger conversation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just cargo-culted that. The right answer is probably for aqua to keep track of that, change it on restart, and insert it into each of these wire as necessary. For now, I've just copied the same string everywhere.

..abet-pe
::
++ handle-doze
|= [way=wire %doze tim=(unit @da)]
^+ ..abet-pe
?~ tim
?~ next-timer
..abet-pe
cancel-timer
?~ next-timer
(set-timer u.tim)
(set-timer:cancel-timer u.tim)
::
++ set-timer
|= tim=@da
=. tim +(tim) :: nobody's perfect
philipcmonk marked this conversation as resolved.
Show resolved Hide resolved
~? debug=| [who=who %setting-timer tim]
=. next-timer `tim
=. this (emit-moves [ost %wait /(scot %p who) tim]~)
..abet-pe
::
++ cancel-timer
~? debug=| [who=who %cancell-timer (need next-timer)]
=. this (emit-moves [ost %rest /(scot %p who) (need next-timer)]~)
=. next-timer ~
..abet-pe
::
++ take-wake
|= [way=wire ~]
~? debug=| [who=who %aqua-behn-wake now]
=. next-timer ~
=. this
%- emit-aqua-events
[%event who [//behn/0v1n.2m9vh %wake ~]]~
..abet-pe
--
--
78 changes: 78 additions & 0 deletions app/aqua-dill.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
:: Would love to see a proper stateful terminal handler. Ideally,
:: you'd be able to ^X into the virtual ship, like the old ^W.
::
:: However, that's probably not the primary way of interacting with
:: it. In practice, most of the time you'll be running from a file
:: (eg for automated testing) or fanning the same command to multiple
:: ships or otherwise making use of the fact that we can
:: programmatically send events.
::
/- aquarium
=, aquarium
=> $~ |%
+$ move (pair bone card)
+$ card
$% [%poke wire dock %aqua-events (list aqua-event)]
[%peer wire dock path]
[%pull wire dock ~]
==
::
+$ state
$: %0
subscribed=_|
==
--
=, gall
=| moves=(list move)
|_ $: bowl
state
==
++ this .
++ apex %_(this moves ~)
++ abet [(flop moves) this]
++ emit-moves
|= ms=(list move)
%_(this moves (weld ms moves))
::
++ emit-aqua-events
|= aes=(list aqua-event)
%- emit-moves
[ost %poke /aqua-events [our %aqua] %aqua-events aes]~
::
++ poke-aqua-vane-control
|= command=?(%subscribe %unsubscribe)
:_ this(subscribed =(command %subscribe))
(aqua-vane-control-handler our ost subscribed command)
::
++ diff-aqua-effects
|= [way=wire afs=aqua-effects]
^- (quip move _this)
=. this apex =< abet
|- ^+ this
?~ ufs.afs
this
=. this
?+ -.q.i.ufs.afs this
%blit (handle-blit who.afs i.ufs.afs)
==
$(ufs.afs t.ufs.afs)
::
++ handle-blit
|= [who=@p way=wire %blit blits=(list blit:dill)]
^+ this
=/ last-line
%+ roll blits
|= [b=blit:dill line=tape]
?- -.b
%lin (tape p.b)
%mor ~& "{<who>}: {line}" ""
%hop line
%bel line
%clr ""
%sag ~& [%save-jamfile-to p.b] line
%sav ~& [%save-file-to p.b] line
%url ~& [%activate-url p.b] line
==
~& last-line
this
--
Loading