Merge pull request #1606 from urbit/modulo-lib-surs

Make modulo follow lib-sur conventions
This commit is contained in:
Jared Tobin 2019-08-12 19:52:51 -07:00 committed by GitHub
commit 14b6816300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 202 additions and 207 deletions

View File

@ -41,6 +41,25 @@
::
=, chat
::
|%
+$ state
$% [%0 str=streams]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -56,7 +75,7 @@
=/ inboxpat /circle/inbox/config/group
=/ circlespat /circles/[(scot %p our.bol)]
=/ inboxwir /circle/[(scot %p our.bol)]/inbox/config/group
=/ inboxi/poke
=/ inboxi/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %i] ~]~)]
=/ fakeannounce=poke
@ -71,10 +90,10 @@
=/ dev=poke
:- %hall-action
[%create %urbit-dev 'Chat about developing on Urbit' %channel]
=/ sourcefakeannounce/poke
=/ sourcefakeannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %hall-internal-announcements] ~]~)]
=/ sourceannounce/poke
=/ sourceannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[~marzod %announcements] ~]~)]
=/ hallactions=(list move)
@ -99,7 +118,7 @@
[ost.bol %poke /chat [our.bol %launch] launcha]
==
:_ this
%+ weld moves hallactions
%+ weld moves hallactions
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
this(sta u.old)
::
@ -115,8 +134,8 @@
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
[cir (add num.last 1)]
=/ maptjson=(map @t json)
%- my
:~ ['config' (config-to-json str)]
%- my
:~ ['config' (config-to-json str)]
['numbers' (numbers-to-json numbers)]
==
[%o maptjson]
@ -142,7 +161,7 @@
?~ envs
~
=/ length/@ (lent u.envs)
=/ start/@
=/ start/@
?: (gte length 100)
(sub length 100)
0
@ -247,7 +266,7 @@
^- [circle:hall (list envelope:hall)]
[cir ~]
::
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -281,7 +300,7 @@
::
=* messages messages.str.sta
=/ circle/circle:hall [`@p`(slav %p &2:wir) &3:wir]
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -391,7 +410,7 @@
?+ -.dif.sto
[~ this]
::
:: %full: set all of config without side effects
:: %full: set all of config without side effects
::
%full
=* conf cof.dif.sto

View File

@ -1,4 +1,6 @@
/+ *server, launch
/- launch
/+ *server
::
/= index
/^ $-(marl manx)
/: /===/app/launch/index /!noun/
@ -22,6 +24,21 @@
::
=, launch
::
|%
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -35,7 +52,7 @@
[~ this(sta u.old)]
::
++ poke-launch-action
|= act=action:launch
|= act=action
^- (quip move _this)
=/ beforedata (~(get by data.sta) name.act)
=/ newdata

View File

@ -34,6 +34,15 @@
/: /===/app/publish/img /_ /png/
::
|%
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ move [bone card]
::
@ -268,7 +277,7 @@
(~(get by subs.sat) who.del col.del)
=/ new=collection
?~ old
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
[~ ~] [%white ~] ~ now.bol
==
%= u.old
@ -348,7 +357,7 @@
[~ da-this]
=. subs.sat (~(del by subs.sat) who.del col.del)
:- ~(tap in ~(key by pos.u.old))
%- da-emil
%- da-emil
:- [ost.bol %pull /collection/[col.del] [who.del %publish] ~]
(affection-primary del)
:: iterate through post ids collected before, removing each from
@ -373,7 +382,7 @@
da-this
?. (~(has in ~(key by pos.u.old)) u.pos.del)
da-this
=/ new=collection
=/ new=collection
%= u.old
pos (~(del by pos.u.old) u.pos.del)
com (~(del by com.u.old) u.pos.del)
@ -392,7 +401,7 @@
++ da-remove-unread
|= [who=@p coll=@tas post=@tas]
^+ da-this
=. unread.sat (~(del in unread.sat) who coll post)
=. unread.sat (~(del in unread.sat) who coll post)
(da-emil make-tile-moves)
::
++ da-remove-latest
@ -482,7 +491,7 @@
^+ da-this
=/ new-post=post-info (need (get-post-info-by-index who coll post))
=/ col=collection (need (get-coll-by-index who coll))
::
::
=/ pre=(list @tas) ~
=/ suf=(list @tas)
?: pinned.new-post
@ -635,7 +644,7 @@
:: 1st part of multi-part, store partial delta and don't process it
::
=/ del=delta
:* %total our.bol col [ost.bol dat]
:* %total our.bol col [ost.bol dat]
~ ~ [~ ~] [%white ~] ~ now.bol
==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
@ -648,7 +657,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -665,7 +674,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -733,8 +742,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
(~(put by pos.dat.u.partial.u.awa) pos [ost.bol dat])
com.dat.u.partial.u.awa
[~ ~]
@ -784,8 +793,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -801,8 +810,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -881,7 +890,7 @@
=/ pax=path /web/publish/[name.act]/publish-info
=/ blog-perms=card
:* %perm /perms q.byk.bol
/web/publish/[name.act]
/web/publish/[name.act]
%rw `read.perm.act `write.perm.act
==
=/ info-perms=card
@ -999,7 +1008,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
kills
moves
@ -1194,7 +1203,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
moves
make-tile-moves
@ -1361,6 +1370,68 @@
::
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
++ make-tile-moves
^- (list move)
%+ turn (prey:pubsub:userlib /publishtile bol)

View File

@ -1,69 +1,6 @@
/- hall
/- *chat, hall
/+ hall-json
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
::
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ state
$% [%0 str=streams]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
::
::
:: +utilities
::
++ msg-to-json
=, enjs:format
|= upd=update
@ -88,7 +25,7 @@
^- json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::
@ -135,6 +72,4 @@
[%length (numb len)]
==
==
::
--
::

View File

@ -1,24 +0,0 @@
::
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
::
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
::
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
--
::

View File

@ -166,67 +166,4 @@
::
[%last-update (time:enjs:format last-update.col)]
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
--

View File

@ -1,7 +1,7 @@
::
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ act=action:chat
++ grow

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ str=streams:chat
++ grow
@ -13,7 +13,7 @@
^- ^json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ upd=update:chat
++ grow

View File

@ -1,6 +1,4 @@
::
::
/+ launch
/- launch
::
|_ act=action:launch
::

45
pkg/arvo/sur/chat.hoon Normal file
View File

@ -0,0 +1,45 @@
/- hall
::
|%
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
--

7
pkg/arvo/sur/launch.hoon Normal file
View File

@ -0,0 +1,7 @@
|%
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
--

View File

@ -1,15 +1,15 @@
|%
::
+$ action
$% $: %new-collection
name=@tas
title=@t
$% $: %new-collection
name=@tas
title=@t
com=comment-config
edit=edit-config
perm=perm-config
==
::
$: %new-post
$: %new-post
who=@p
coll=@tas
name=@tas
@ -98,16 +98,6 @@
last-update=@da
==
::
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ delta
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]