shrub/app/pipe.hoon

94 lines
2.5 KiB
Plaintext
Raw Normal View History

/+ hall
2016-11-17 04:42:58 +03:00
::
2016-03-25 01:42:39 +03:00
=> |%
++ move (pair bone card)
++ card
$% {$peel wire dock mark path}
{$poke wire dock $hall-command command:hall}
2016-03-25 01:42:39 +03:00
==
--
::
=, gall
2016-03-25 01:42:39 +03:00
|_ {hid/bowl connections/(set {app/term source/path station/knot})}
++ poke-noun
|= arg/*
^- {(list move) _+>.$}
?: ?=($list arg)
2016-03-25 02:55:10 +03:00
(poke-pipe-list ~)
2016-03-25 01:42:39 +03:00
=+ ((soft {$cancel app/term source/path station/knot}) arg)
?^ -
2016-03-25 02:55:10 +03:00
(poke-pipe-cancel app.u source.u station.u)
=+ ((hard {app/term source/path station/knot}) arg)
(poke-pipe-connect app source station)
::
++ poke-pipe-list
2018-03-19 07:18:20 +03:00
|= ~
2016-03-25 02:55:10 +03:00
^- {(list move) _+>.$}
%- %- slog
%+ turn ~(tap in connections)
2016-03-25 02:55:10 +03:00
|= {app/term source/path station/knot}
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
[~ +>.$]
::
++ poke-pipe-cancel
|= {app/term source/path station/knot}
^- {(list move) _+>.$}
?. (~(has in connections) [app source station])
2016-03-25 01:42:39 +03:00
%- %- slog :~
2016-03-25 02:55:10 +03:00
leaf+"no connection:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
2016-03-25 01:42:39 +03:00
==
2016-03-25 02:55:10 +03:00
[~ +>.$]
%- %- slog :~
leaf+"canceling:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
==
[~ +>.$(connections (~(del in connections) [app source station]))]
2016-03-25 01:42:39 +03:00
::
2016-03-25 02:55:10 +03:00
++ poke-pipe-connect
2016-03-25 01:42:39 +03:00
|= {app/term source/path station/knot}
^- {(list move) _+>.$}
:_ +>.$(connections (~(put in connections) [app source station]))
:_ ~
~& [%peeling app source station]
:* ost.hid %peel [%subscribe app station source]
[our.hid app] %hall-speeches source
2016-03-25 01:42:39 +03:00
==
::
++ diff-hall-speeches
|= {way/wire speeches/(list speech:hall)}
2016-03-25 01:42:39 +03:00
^- {(list move) _+>.$}
?> ?=({$subscribe @ @ *} way)
=+ app=(slav %tas i.t.way)
=+ station=i.t.t.way
=+ source=t.t.t.way
?. (~(has in connections) [app source station])
%- %- slog :~
leaf+"pipe dropping:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
==
[~ +>.$]
:_ +>.$ :_ ~
:* ost.hid %poke [%relay app station source]
[our.hid %hall] %hall-command
2016-03-25 01:42:39 +03:00
%publish
|- ^- (list thought:hall)
2016-03-25 01:42:39 +03:00
?~ speeches
~
:_ $(speeches t.speeches, eny.hid (shax (cat 3 %pipe eny.hid)))
:* `@uvH`(end (sub 'H' 'A') 1 eny.hid)
[[[%& our.hid station] *envelope:hall %pending] ~ ~]
now.hid *(set flavor:hall) i.speeches
2016-03-25 01:42:39 +03:00
==
==
::
++ coup-relay
|= {way/wire saw/(unit tang)}
^- {(list move) _+>.$}
?> ?=({@ @ @ *} way)
?~ saw
[~ +>.$]
%- (slog leaf+"pipe relay failure in:" >way< u.saw)
[~ +>.$]
--