mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 18:48:14 +03:00
Cleaned up %peer and %pull move wires and logic.
This commit is contained in:
parent
f6c574647d
commit
0a610d6419
123
app/hall.hoon
123
app/hall.hoon
@ -1041,6 +1041,19 @@
|
|||||||
::
|
::
|
||||||
|= src/source
|
|= src/source
|
||||||
^+ +>
|
^+ +>
|
||||||
|
=+ seq=(~(get by sequence) cir.src)
|
||||||
|
:: if we're past the range, don't resubscribe.
|
||||||
|
?: ?& ?=(^ ran.src)
|
||||||
|
?=(^ tal.u.ran.src)
|
||||||
|
::
|
||||||
|
?- -.u.tal.u.ran.src
|
||||||
|
$da (gte now.bol +.u.tal.u.ran.src)
|
||||||
|
$ud ?& ?=(^ seq)
|
||||||
|
(gte u.seq +.u.tal.u.ran.src)
|
||||||
|
==
|
||||||
|
==
|
||||||
|
==
|
||||||
|
(so-delta-our %follow | [src ~ ~])
|
||||||
=- (so-delta-our %follow & [[cir.src -] ~ ~])
|
=- (so-delta-our %follow & [[cir.src -] ~ ~])
|
||||||
^- range
|
^- range
|
||||||
?. (~(has by sequence) cir.src) ran.src
|
?. (~(has by sequence) cir.src) ran.src
|
||||||
@ -1318,27 +1331,14 @@
|
|||||||
::> apply %init delta, querying the /burden of the
|
::> apply %init delta, querying the /burden of the
|
||||||
::> ship above us.
|
::> ship above us.
|
||||||
::
|
::
|
||||||
%- da-emit
|
(da-emit (wire-to-peer /burden))
|
||||||
=+ pax=/burden/(scot %p our.bol)
|
|
||||||
:* 0
|
|
||||||
%peer
|
|
||||||
pax
|
|
||||||
[(above our.bol) dap.bol]
|
|
||||||
pax
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ da-observe ::< watch burden bearer
|
++ da-observe ::< watch burden bearer
|
||||||
::> apply %observe delta, querying the /report of
|
::> apply %observe delta, querying the /report of
|
||||||
::> {who} below us.
|
::> {who} below us.
|
||||||
::
|
::
|
||||||
|= who/ship
|
|= who/ship
|
||||||
%- da-emit
|
(da-emit (wire-to-peer /report/(scot %p who)))
|
||||||
:* 0
|
|
||||||
%peer
|
|
||||||
/(scot %p who)/report
|
|
||||||
[who dap.bol]
|
|
||||||
/report
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ da-change-public ::< show/hide membership
|
++ da-change-public ::< show/hide membership
|
||||||
::> add/remove a circle to/from the public
|
::> add/remove a circle to/from the public
|
||||||
@ -1666,36 +1666,26 @@
|
|||||||
::> subscribes this story to each circle.
|
::> subscribes this story to each circle.
|
||||||
::
|
::
|
||||||
|= srs/(set source)
|
|= srs/(set source)
|
||||||
%+ sa-sauce 0 :: subscription is caused by this app
|
|
||||||
=- (murn - same)
|
=- (murn - same)
|
||||||
%+ turn ~(tap in srs)
|
%+ turn ~(tap in srs)
|
||||||
|= {cir/circle ran/range}
|
|= {cir/circle ran/range}
|
||||||
^- (unit card)
|
^- (unit move)
|
||||||
?: =(cir sa-cir) ~ :: ignore self-subs
|
?: =(cir sa-cir) ~ :: ignore self-subs
|
||||||
=+ wat=[%grams %config-l %group-l ~]
|
=+ wat=~[%grams %config-l %group-l]
|
||||||
`(circle-peer nom wat cir ran)
|
`(wire-to-peer (sa-circle-wire wat cir ran))
|
||||||
::
|
::
|
||||||
++ sa-abjure ::< unsubscribe us
|
++ sa-abjure ::< unsubscribe us
|
||||||
::> unsubscribes this story from each circle.
|
::> unsubscribes this story from each circle.
|
||||||
::
|
::
|
||||||
|= srs/(set source)
|
|= srs/(set source)
|
||||||
%+ sa-sauce 0 :: subscription is caused by this app
|
|
||||||
%- zing
|
|
||||||
%+ turn ~(tap in srs)
|
%+ turn ~(tap in srs)
|
||||||
|= {cir/circle ran/range}
|
|= {cir/circle ran/range}
|
||||||
^- (list card)
|
^- move
|
||||||
:_ ~
|
=/ wir
|
||||||
=+ rap=(range-to-path ran)
|
%+ sa-circle-wire
|
||||||
:* %pull
|
~[%grams %config-l %group-l]
|
||||||
;: welp
|
[cir ran]
|
||||||
/[nom]/(scot %p hos.cir)
|
[0 %pull wir [hos.cir dap.bol] ~]
|
||||||
/circle/[nom.cir]
|
|
||||||
/grams/config-l/group-l
|
|
||||||
rap
|
|
||||||
==
|
|
||||||
[hos.cir dap.bol]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ sa-eject ::< unsubscribe ships
|
++ sa-eject ::< unsubscribe ships
|
||||||
::> removes ships {sis} from {followers}.
|
::> removes ships {sis} from {followers}.
|
||||||
@ -1720,30 +1710,53 @@
|
|||||||
==
|
==
|
||||||
c
|
c
|
||||||
(~(put in c) b)
|
(~(put in c) b)
|
||||||
|
::
|
||||||
|
++ sa-circle-wire ::< /circle peer wire
|
||||||
|
::> constructs a /circle %peer path for subscribing
|
||||||
|
::> {nom} to a source.
|
||||||
|
::
|
||||||
|
|= {wat/(list circle-data) source}
|
||||||
|
^- wire
|
||||||
|
;: weld
|
||||||
|
/circle/[nom]/(scot %p hos.cir)/[nom.cir]
|
||||||
|
wat
|
||||||
|
(range-to-path ran)
|
||||||
|
==
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
::> ||
|
::> ||
|
||||||
::> || %wire-parsing
|
::> || %wire-utility
|
||||||
::> ||
|
::> ||
|
||||||
::+|
|
::+|
|
||||||
::
|
::
|
||||||
++ target ::< ship+path from wire
|
++ wire-to-peer ::< peer move from wire
|
||||||
|
::> builds the peer move associated with the wire.
|
||||||
|
::
|
||||||
|
|= wir/wire
|
||||||
|
^- move
|
||||||
|
=+ tar=(wire-to-target wir)
|
||||||
|
[0 %peer wir [p.tar dap.bol] q.tar]
|
||||||
|
::
|
||||||
|
++ wire-to-target ::< ship+path from wire
|
||||||
::> parses {wir} to obtain the target ship and the
|
::> parses {wir} to obtain the target ship and the
|
||||||
::> query path.
|
::> query path.
|
||||||
::
|
::
|
||||||
|= wir/wire
|
|= wir/wire
|
||||||
^- (pair ship path)
|
^- (pair ship path)
|
||||||
?+ wir !!
|
?+ wir ~&(wir !!)
|
||||||
{@ @ $circle *}
|
{$circle @ @ *}
|
||||||
[(slav %p i.t.wir) t.t.wir]
|
:- (slav %p i.t.t.wir)
|
||||||
|
(welp /circle t.t.t.wir)
|
||||||
::
|
::
|
||||||
{$burden *}
|
{$burden *}
|
||||||
[(above our.bol) wir]
|
:- (above our.bol)
|
||||||
|
/burden/(scot %p our.bol)
|
||||||
::
|
::
|
||||||
{@ $report *}
|
{$report @ *}
|
||||||
[(slav %p i.wir) t.wir]
|
:- (slav %p i.t.wir)
|
||||||
|
/report
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ etch ::< parse wire
|
++ etch ::< parse wire
|
||||||
@ -1754,11 +1767,11 @@
|
|||||||
|= wir/wire
|
|= wir/wire
|
||||||
^- weir
|
^- weir
|
||||||
?+ wir !!
|
?+ wir !!
|
||||||
{@ @ $circle @ *}
|
{$circle @ @ @ *}
|
||||||
:: us, host, $circle, target
|
:: $circle, us, host, target
|
||||||
:^ %circle
|
:^ %circle
|
||||||
i.wir
|
i.t.wir
|
||||||
[(slav %p i.t.wir) i.t.t.t.wir]
|
[(slav %p i.t.t.wir) i.t.t.t.wir]
|
||||||
(path-to-range t.t.t.t.wir)
|
(path-to-range t.t.t.t.wir)
|
||||||
::
|
::
|
||||||
{$repeat @ @ @ $~}
|
{$repeat @ @ @ $~}
|
||||||
@ -1790,19 +1803,6 @@
|
|||||||
=+ wer=(etch wir)
|
=+ wer=(etch wir)
|
||||||
?>(?=($repeat -.wer) (fun cir.wer ses.wer))
|
?>(?=($repeat -.wer) (fun cir.wer ses.wer))
|
||||||
::
|
::
|
||||||
++ circle-peer ::< /circle peer card
|
|
||||||
::> constructs a %peer move to subscribe {nom} to a
|
|
||||||
::> source.
|
|
||||||
::
|
|
||||||
|= {nom/naem wat/(list circle-data) source}
|
|
||||||
^- card
|
|
||||||
=+ pax=:(welp /circle/[nom.cir] wat (range-to-path ran))
|
|
||||||
:* %peer
|
|
||||||
(welp /[nom]/(scot %p hos.cir) pax)
|
|
||||||
[hos.cir dap.bol]
|
|
||||||
pax
|
|
||||||
==
|
|
||||||
::
|
|
||||||
::> ||
|
::> ||
|
||||||
::> || %new-events
|
::> || %new-events
|
||||||
::> ||
|
::> ||
|
||||||
@ -2208,7 +2208,7 @@
|
|||||||
:::
|
:::
|
||||||
|= {wir/wire fal/(unit tang)}
|
|= {wir/wire fal/(unit tang)}
|
||||||
^- (quip move _+>)
|
^- (quip move _+>)
|
||||||
?. ?=({@ @ $circle *} wir)
|
?. ?=($circle -.wir)
|
||||||
?~ fal [~ +>]
|
?~ fal [~ +>]
|
||||||
~| reap-fail+wir
|
~| reap-fail+wir
|
||||||
(mean u.fal)
|
(mean u.fal)
|
||||||
@ -2228,8 +2228,7 @@
|
|||||||
|= wir/wire
|
|= wir/wire
|
||||||
^- (quip move _+>)
|
^- (quip move _+>)
|
||||||
:_ +>
|
:_ +>
|
||||||
=+ tar=(target wir)
|
[(wire-to-peer wir) ~]
|
||||||
[0 %peer wir [p.tar dap.bol] q.tar]~
|
|
||||||
::
|
::
|
||||||
++ quit-circle ::< dropped circle sub
|
++ quit-circle ::< dropped circle sub
|
||||||
::> gall dropped our subscription. resubscribe.
|
::> gall dropped our subscription. resubscribe.
|
||||||
|
Loading…
Reference in New Issue
Block a user