mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-11 08:55:23 +03:00
filled out subscription, state update, and mark conversion logic
This commit is contained in:
parent
0c6baef0d9
commit
9d2acd36fa
@ -53,9 +53,17 @@
|
||||
=< ta-done
|
||||
(~(ta-hall-create-circle ta ~ bol) /c 'collections')
|
||||
::
|
||||
:~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
|
||||
:* [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
|
||||
[ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]
|
||||
[ost.bol %peer /invites [our.bol %hall] /circle/i/grams]
|
||||
::
|
||||
?. =(%duke (clan:title our.bol))
|
||||
~
|
||||
:_ ~
|
||||
:* ost.bol %poke /client-action [our.bol %hall]
|
||||
%hall-action %source %inbox &
|
||||
(sy [[(^sein:title our.bol) %urbit-meta] ~]~)
|
||||
==
|
||||
==
|
||||
==
|
||||
?- -.u.old
|
||||
@ -125,20 +133,20 @@
|
||||
(~(ta-write ta ~ bol) /web/landscape/onboard/json [%json !>(jon)])
|
||||
[~ this]
|
||||
::
|
||||
::
|
||||
::
|
||||
::
|
||||
:: +peer:
|
||||
::
|
||||
++ peer
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
:_ this
|
||||
[ost.bol %diff %collections-prize str.sta]~
|
||||
::
|
||||
:: +reap: recieve acknowledgement for peer, retry on failure
|
||||
::
|
||||
++ reap
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
~& reap+[wir =(~ err)]
|
||||
?~ err
|
||||
[~ this]
|
||||
?~ wir
|
||||
@ -160,23 +168,14 @@
|
||||
::
|
||||
%our
|
||||
[~ this]
|
||||
::
|
||||
%sub
|
||||
[~ this]
|
||||
==
|
||||
|
||||
:: :~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
|
||||
:: [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]
|
||||
:: [ost.bol %peer /invites [our.bol %hall] /circle/i/grams]
|
||||
:: ==
|
||||
|
||||
|
||||
::
|
||||
:: +quit:
|
||||
::
|
||||
++ quit
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
~& quit+[wir =(~ err)]
|
||||
?~ err
|
||||
[~ this]
|
||||
?~ wir
|
||||
@ -198,18 +197,16 @@
|
||||
::
|
||||
%our
|
||||
[~ this]
|
||||
::
|
||||
%sub
|
||||
[~ this]
|
||||
==
|
||||
::
|
||||
:: +diff-hall-prize:
|
||||
::
|
||||
::
|
||||
::
|
||||
++ diff-hall-prize
|
||||
|= [wir=wire piz=prize:hall]
|
||||
^- (quip move _this)
|
||||
::
|
||||
::
|
||||
~& prize+[wir piz]
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
@ -219,65 +216,205 @@
|
||||
::
|
||||
%circles
|
||||
?> ?=(%circles -.piz)
|
||||
=/ circs=(set name:hall) (~(dif in cis.piz) (sy ~[%inbox %i %public]))
|
||||
=/ noms=(set name:hall) (~(dif in cis.piz) (sy ~[%inbox %i %public]))
|
||||
=/ circs=(map circle:hall (unit config:hall))
|
||||
^- (map circle:hall (unit config:hall))
|
||||
%- ~(rep in noms)
|
||||
|= [n=name:hall out=(map circle:hall (unit config:hall))]
|
||||
^- (map circle:hall (unit config:hall))
|
||||
(~(put by out) [[our.bol n] ~])
|
||||
::
|
||||
:_ this
|
||||
:_ this(our-circles.str.sta (~(uni in our-circles.str.sta) circs))
|
||||
^- (list move)
|
||||
%+ turn ~(tap in circs)
|
||||
|= circ=name:hall
|
||||
%+ turn ~(tap in noms)
|
||||
|= nom=name:hall
|
||||
^- move
|
||||
[ost.bol %peer /our/[circ] [our.bol %hall] /circle/[circ]/config]
|
||||
[ost.bol %peer /our/[nom] [our.bol %hall] /circle/[nom]/config]
|
||||
::
|
||||
:: %inbox:
|
||||
:: %inbox: fill inbox config, messages and remote configs with prize data
|
||||
::
|
||||
%inbox
|
||||
[~ this]
|
||||
?> ?=(%circle -.piz)
|
||||
:- ~
|
||||
%= this
|
||||
con.inbox.str.sta `loc.cos.piz
|
||||
env.inbox.str.sta nes.piz
|
||||
sub-circles.str.sta (~(run by rem.cos.piz) |=(a=config:hall `a))
|
||||
==
|
||||
::
|
||||
:: %invites
|
||||
:: %invites: fill invite messages with prize data
|
||||
::
|
||||
%invites
|
||||
[~ this]
|
||||
?> ?=(%circle -.piz)
|
||||
:- ~
|
||||
%= this
|
||||
invites.str.sta nes.piz
|
||||
==
|
||||
::
|
||||
:: %our:
|
||||
::
|
||||
%our
|
||||
[~ this]
|
||||
::
|
||||
%sub
|
||||
[~ this]
|
||||
?> ?=(%circle -.piz)
|
||||
=/ nom=name:hall &2:wir
|
||||
:- ~
|
||||
%= this
|
||||
our-circles.str.sta
|
||||
(~(put by our-circles.str.sta) [our.bol nom] `loc.cos.piz)
|
||||
==
|
||||
==
|
||||
|
||||
:: :~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
|
||||
:: [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]
|
||||
:: [ost.bol %peer /invites [our.bol %hall] /circle/i/grams]
|
||||
:: ==
|
||||
|
||||
::
|
||||
:: +diff-hall-rumor
|
||||
::
|
||||
::
|
||||
::
|
||||
++ diff-hall-rumor
|
||||
|= [wir=wire rum=rumor:hall]
|
||||
^- (quip move _this)
|
||||
~& rumor+[wir rum]
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
:: %circles:
|
||||
::
|
||||
%circles
|
||||
[~ this]
|
||||
?> ?=(%circles -.rum)
|
||||
=/ circ=circle:hall [our.bol cir.rum]
|
||||
?: add.rum
|
||||
:_ this(our-circles.str.sta (~(put by our-circles.str.sta) circ ~))
|
||||
[ost.bol %peer /our/[cir.rum] [our.bol %hall] /circle/[cir.rum]/config]~
|
||||
:_ this(our-circles.str.sta (~(del by our-circles.str.sta) circ))
|
||||
:- [ost.bol %pull /our/[cir.rum] [our.bol %hall] ~]
|
||||
(send-rumor %circle-change %our circ ~)
|
||||
::
|
||||
:: %inbox:
|
||||
::
|
||||
%inbox
|
||||
[~ this]
|
||||
?> ?=(%circle -.rum)
|
||||
?+ -.rum.rum
|
||||
~& unprocessed-rumor+rum.rum
|
||||
[~ this]
|
||||
::
|
||||
:: %remove:
|
||||
::
|
||||
%remove
|
||||
~& %removed-story
|
||||
[~ this]
|
||||
::
|
||||
:: %gram: inbox has recieved messages
|
||||
::
|
||||
%gram
|
||||
:- (send-rumor [%new-msg %inbox nev.rum.rum])
|
||||
this(env.inbox.str.sta [nev.rum.rum env.inbox.str.sta])
|
||||
::
|
||||
:: %config: inbox config has changed
|
||||
::
|
||||
%config
|
||||
=* circ cir.rum.rum
|
||||
?+ -.dif.rum.rum
|
||||
~& unprocessed-config+dif.rum.rum
|
||||
[~ this]
|
||||
::
|
||||
:: %source: the sources of our inbox have changed
|
||||
::
|
||||
%source
|
||||
?> =(circ [our.bol %inbox])
|
||||
:: we've added a source to our inbox
|
||||
::
|
||||
?: add.dif.rum.rum
|
||||
:- ~
|
||||
%= this
|
||||
sub-circles.str.sta
|
||||
(~(put by sub-circles.str.sta) cir.src.dif.rum.rum ~)
|
||||
==
|
||||
:: we've removed a source from our inbox
|
||||
::
|
||||
:- (send-rumor %circle-change %sub cir.src.dif.rum.rum ~)
|
||||
%= this
|
||||
sub-circles.str.sta
|
||||
(~(del by sub-circles.str.sta) cir.src.dif.rum.rum)
|
||||
==
|
||||
::
|
||||
:: %full: recieved a full config update for one of our sources
|
||||
::
|
||||
%full
|
||||
=* conf cof.dif.rum.rum
|
||||
:- (send-rumor %circle-change %sub circ `conf)
|
||||
%= this
|
||||
sub-circles.str.sta (~(put by sub-circles.str.sta) circ `conf)
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
:: %invites:
|
||||
::
|
||||
%invites
|
||||
[~ this]
|
||||
?> ?=(%circle -.rum)
|
||||
?> ?=(%gram -.rum.rum)
|
||||
:- (send-rumor [%new-msg %invites nev.rum.rum])
|
||||
this(invites.str.sta [nev.rum.rum invites.str.sta])
|
||||
::
|
||||
:: %our:
|
||||
::
|
||||
%our
|
||||
?> ?=(%circle -.rum)
|
||||
?+ -.rum.rum
|
||||
~& unprocessed-rumor+rum.rum
|
||||
[~ this]
|
||||
::
|
||||
:: %remove:
|
||||
::
|
||||
%remove
|
||||
~& %removed-story
|
||||
[~ this]
|
||||
::
|
||||
:: %config:
|
||||
::
|
||||
%config
|
||||
=* circ cir.rum.rum
|
||||
=* diff dif.rum.rum
|
||||
?+ -.diff
|
||||
~& unprocessed-config+diff
|
||||
[~ this]
|
||||
::
|
||||
:: %full: recieved a full config update for one of our sources
|
||||
::
|
||||
%full
|
||||
=* conf cof.dif.rum.rum
|
||||
:- (send-rumor %circle-change %our circ `conf)
|
||||
%= this
|
||||
our-circles.str.sta (~(put by our-circles.str.sta) circ `conf)
|
||||
==
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
:: +send-rumor: send a rumor to all subscribers
|
||||
::
|
||||
++ send-rumor
|
||||
|= rum=rumor
|
||||
^- (list move)
|
||||
%+ turn (prey:pubsub:userlib /data bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %collections-rumor rum]
|
||||
::
|
||||
:: +poke-noun: debugging stuff
|
||||
::
|
||||
++ poke-noun
|
||||
|= a=@t
|
||||
^- (quip move _this)
|
||||
?: =(a 'check all subs')
|
||||
~& 'here are all incoming subs'
|
||||
~& ^- (list (pair ship path))
|
||||
%+ turn ~(tap by sup.bol)
|
||||
|= [b=bone s=ship p=path]
|
||||
^- (pair ship path)
|
||||
[s p]
|
||||
[~ this]
|
||||
::
|
||||
%sub
|
||||
?: =(a 'print state')
|
||||
~& str.sta
|
||||
[~ this]
|
||||
==
|
||||
[~ this]
|
||||
--
|
||||
|
||||
|
||||
@ -292,14 +429,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3256,6 +3256,14 @@
|
||||
?: ?=({$circle *} p) ~
|
||||
`[s p]
|
||||
[~ +>]
|
||||
?: =(a 'check all subs')
|
||||
~& 'here are all incoming subs'
|
||||
~& ^- (list (pair ship path))
|
||||
%+ turn ~(tap by sup.bol)
|
||||
|= {b/bone s/ship p/path}
|
||||
^- (pair ship path)
|
||||
[s p]
|
||||
[~ +>]
|
||||
?: =(a 'rebuild')
|
||||
~& 'rebuilding message references...'
|
||||
=- [~ +>.$(stories -)]
|
||||
|
@ -16,6 +16,12 @@
|
||||
[%perm wire desk path rite:clay]
|
||||
[%peer wire dock path]
|
||||
[%pull wire dock ~]
|
||||
[%diff diff]
|
||||
==
|
||||
::
|
||||
+$ diff
|
||||
$% [%collections-prize prize]
|
||||
[%collections-rumor rumor]
|
||||
==
|
||||
::
|
||||
+$ poke
|
||||
@ -31,13 +37,13 @@
|
||||
+$ streams
|
||||
$: :: inbox config and the last 30 messages in it
|
||||
::
|
||||
inbox=[con=config env=(list envelope:hall)]
|
||||
inbox=[con=(unit config:hall) env=(list envelope:hall)]
|
||||
:: names and configs of all circles we own
|
||||
::
|
||||
our-circles=(map name:hall config:hall)
|
||||
:: names and configs of all circles we're subscribed to
|
||||
our-circles=(map circle:hall (unit config:hall))
|
||||
:: names and configs of all circles we're subscribed to
|
||||
::
|
||||
sub-circles=(map circle:hall config:hall)
|
||||
sub-circles=(map circle:hall (unit config:hall))
|
||||
:: all the DM invites we've received
|
||||
::
|
||||
invites=(list envelope:hall)
|
||||
@ -46,13 +52,13 @@
|
||||
+$ prize
|
||||
$: :: inbox config and the last 30 messages in it
|
||||
::
|
||||
inbox=[con=config env=(list envelope:hall)]
|
||||
inbox=[con=(unit config:hall) env=(list envelope:hall)]
|
||||
:: names and configs of all circles we own
|
||||
::
|
||||
our-circles=(map name:hall config:hall)
|
||||
:: names and configs of all circles we're subscribed to
|
||||
our-circles=(map circle:hall (unit config:hall))
|
||||
:: names and configs of all circles we're subscribed to
|
||||
::
|
||||
sub-circles=(map circle:hall config:hall)
|
||||
sub-circles=(map circle:hall (unit config:hall))
|
||||
:: all the DM invites we've received
|
||||
::
|
||||
invites=(list envelope:hall)
|
||||
@ -62,10 +68,10 @@
|
||||
$% :: if config is given, either add new circle or update existing one
|
||||
:: if config is nil then delete circle
|
||||
::
|
||||
[%circle-change circle:hall config:hall]
|
||||
[%circle-change wit=?(%our %sub) cir=circle:hall con=(unit config:hall)]
|
||||
:: recieved a new inbox message or DM invite
|
||||
::
|
||||
[%new-msg ?(%inbox %invites) envelope:hall]
|
||||
[%new-msg nom=?(%inbox %invites) env=envelope:hall]
|
||||
==
|
||||
::
|
||||
+$ collection [meta=config data=(map nom=knot =item)]
|
||||
|
@ -2,12 +2,40 @@
|
||||
::
|
||||
/? 309
|
||||
::
|
||||
/- hall
|
||||
/+ collections, hall-json
|
||||
::
|
||||
|_ piz=prize:collections
|
||||
++ grow
|
||||
|%
|
||||
++ json ~
|
||||
++ json
|
||||
=, enjs:format
|
||||
^- ^json
|
||||
%- pairs
|
||||
:~ :- %inbox
|
||||
%- pairs
|
||||
:~ [%config ?~(con.inbox.piz ~ (conf:enjs:hall-json u.con.inbox.piz))]
|
||||
[%envelopes %a (turn env.inbox.piz enve:enjs:hall-json)]
|
||||
==
|
||||
::
|
||||
:+ %our-circles %a
|
||||
%+ turn ~(tap by our-circles.piz)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
%- pairs
|
||||
:~ [%circle (circ:enjs:hall-json cir)]
|
||||
[%config ?~(con ~ (conf:enjs:hall-json u.con))]
|
||||
==
|
||||
::
|
||||
:+ %sub-circles %a
|
||||
%+ turn ~(tap by our-circles.piz)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
%- pairs
|
||||
:~ [%circle (circ:enjs:hall-json cir)]
|
||||
[%config ?~(con ~ (conf:enjs:hall-json u.con))]
|
||||
==
|
||||
::
|
||||
[%invites %a (turn invites.piz enve:enjs:hall-json)]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|
@ -7,7 +7,25 @@
|
||||
|_ rum=rumor:collections
|
||||
++ grow
|
||||
|%
|
||||
++ json ~
|
||||
++ json
|
||||
=, enjs:format
|
||||
^- ^json
|
||||
%+ frond -.rum
|
||||
?- -.rum
|
||||
%circle-change
|
||||
%- pairs
|
||||
:~ [%which [%s wit.rum]]
|
||||
[%circle (circ:enjs:hall-json cir.rum)]
|
||||
[%config ?~(con.rum ~ (conf:enjs:hall-json u.con.rum))]
|
||||
==
|
||||
::
|
||||
%new-msg
|
||||
%- pairs
|
||||
:~ [%circle [%s nom.rum]]
|
||||
[%envelope (enve:enjs:hall-json env.rum)]
|
||||
==
|
||||
==
|
||||
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|
Loading…
Reference in New Issue
Block a user