track bones for subscriptions; track date of last update to collection

This commit is contained in:
Isaac Visintainer 2019-06-26 16:21:35 -07:00
parent ae86636eac
commit 9830821156
3 changed files with 46 additions and 21 deletions

View File

@ -209,6 +209,10 @@
~& whoms ~& whoms
~& ships ~& ships
[~ this] [~ this]
::
%print-bowl
~& bol
[~ this]
:: ::
%update-tile %update-tile
[make-tile-moves this] [make-tile-moves this]
@ -255,11 +259,9 @@
(~(get by subs.sat) who.del col.del) (~(get by subs.sat) who.del col.del)
=/ new=collection =/ new=collection
?~ old ?~ old
[[ost.bol dat.del] ~ ~ [~ ~] [%white ~] ~] [[ost.bol dat.del] ~ ~ [~ ~] [%white ~] ~ now.bol]
u.old(col [ost.bol dat.del]) u.old(col [ost.bol dat.del], last-update now.bol)
~& [our.bol who.del]
=? contributors.new =(our.bol who.del) =? contributors.new =(our.bol who.del)
~& %should-set-contributors
(get-contributors col.del) (get-contributors col.del)
=? pubs.sat =(our.bol who.del) =? pubs.sat =(our.bol who.del)
(~(put by pubs.sat) col.del new) (~(put by pubs.sat) col.del new)
@ -274,8 +276,13 @@
(~(get by subs.sat) who.del col.del) (~(get by subs.sat) who.del col.del)
=/ new=collection =/ new=collection
?~ old ?~ old
[[0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~ [~ ~] [%white ~] ~] :* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
u.old(pos (~(put by pos.u.old) pos.del [ost.bol dat.del])) [~ ~] [%white ~] ~ now.bol
==
%= u.old
pos (~(put by pos.u.old) pos.del [ost.bol dat.del])
last-update now.bol
==
=? pubs.sat =(our.bol who.del) =? pubs.sat =(our.bol who.del)
(~(put by pubs.sat) col.del new) (~(put by pubs.sat) col.del new)
=? subs.sat !=(our.bol who.del) =? subs.sat !=(our.bol who.del)
@ -291,8 +298,13 @@
(~(get by subs.sat) who.del col.del) (~(get by subs.sat) who.del col.del)
=/ new=collection =/ new=collection
?~ old ?~ old
[[0 %.n ~] ~ (my [pos.del ost.bol dat.del] ~) [~ ~] [%white ~] ~] :* [0 %.n ~] ~ (my [pos.del ost.bol dat.del] ~)
u.old(com (~(put by com.u.old) pos.del [ost.bol dat.del])) [~ ~] [%white ~] ~ now.bol
==
%= u.old
com (~(put by com.u.old) pos.del [ost.bol dat.del])
last-update now.bol
==
=? pubs.sat =(our.bol who.del) =? pubs.sat =(our.bol who.del)
(~(put by pubs.sat) col.del new) (~(put by pubs.sat) col.del new)
=? subs.sat !=(our.bol who.del) =? subs.sat !=(our.bol who.del)
@ -300,9 +312,9 @@
(da-emil (affection del)) (da-emil (affection del))
:: ::
%total %total
~& del
=? contributors.dat.del =(our.bol who.del) =? contributors.dat.del =(our.bol who.del)
(get-contributors col.del) (get-contributors col.del)
=. last-update.dat.del now.bol
=? pubs.sat =(our.bol who.del) =? pubs.sat =(our.bol who.del)
(~(put by pubs.sat) col.del dat.del) (~(put by pubs.sat) col.del dat.del)
=? subs.sat !=(our.bol who.del) =? subs.sat !=(our.bol who.del)
@ -576,7 +588,6 @@
|= [wir=wire wen=@da mad=made-result:ford] |= [wir=wire wen=@da mad=made-result:ford]
^- (quip move _this) ^- (quip move _this)
?+ wir ?+ wir
~& mad
[~ this] [~ this]
:: ::
[%collection @t ~] [%collection @t ~]
@ -605,7 +616,7 @@
:: ::
=/ del=delta =/ del=delta
:* %total our.bol col [ost.bol dat] :* %total our.bol col [ost.bol dat]
~ ~ [~ ~] [%white ~] ~ ~ ~ [~ ~] [%white ~] ~ now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -624,6 +635,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(del by awaiting.sat) col) =. awaiting.sat (~(del by awaiting.sat) col)
(bake del) (bake del)
@ -640,6 +652,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -671,7 +684,7 @@
:: ::
=/ del=delta =/ del=delta
:* %total our.bol col [0 %.n ~] (my [pos ost.bol dat] ~) :* %total our.bol col [0 %.n ~] (my [pos ost.bol dat] ~)
~ [~ ~] [%white ~] ~ ~ [~ ~] [%white ~] ~ now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -690,6 +703,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(del by awaiting.sat) col) =. awaiting.sat (~(del by awaiting.sat) col)
(bake del) (bake del)
@ -706,6 +720,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -737,7 +752,7 @@
:: ::
=/ del=delta =/ del=delta
:* %total our.bol col [0 %.n ~] ~ (my [pos ost.bol dat] ~) :* %total our.bol col [0 %.n ~] ~ (my [pos ost.bol dat] ~)
[~ ~] [%white ~] ~ [~ ~] [%white ~] ~ now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -756,6 +771,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(del by awaiting.sat) col) =. awaiting.sat (~(del by awaiting.sat) col)
(bake del) (bake del)
@ -772,6 +788,7 @@
[~ ~] [~ ~]
[%white ~] [%white ~]
~ ~
now.bol
== ==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del) =. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
[~ this] [~ this]
@ -1167,8 +1184,8 @@
=/ wir=wire /collection/[coll.act] =/ wir=wire /collection/[coll.act]
=/ title=(unit @t) (~(get by invites.sat) [who.act coll.act]) =/ title=(unit @t) (~(get by invites.sat) [who.act coll.act])
=. invites.sat (~(del by invites.sat) [who.act coll.act]) =. invites.sat (~(del by invites.sat) [who.act coll.act])
:_ this :_ this(outgoing.sat (~(put by outgoing.sat) wir ost.bol))
;: welp ;: welp
make-tile-moves make-tile-moves
[ost.bol %peer wir [who.act %write] wir]~ [ost.bol %peer wir [who.act %write] wir]~
?~ title ~ ?~ title ~
@ -1181,6 +1198,10 @@
:: %unsubscribe: unsub from a foreign blog, delete all state related to it :: %unsubscribe: unsub from a foreign blog, delete all state related to it
:: ::
%unsubscribe %unsubscribe
=/ wir=wire /collection/[coll.act]
=/ bon=(unit bone) (~(get by outgoing.sat) wir)
?~ bon
~| %nonexistent-subscription^wir !!
=/ new-latest=(list [@p @tas @tas]) =/ new-latest=(list [@p @tas @tas])
%+ skim latest.sat %+ skim latest.sat
|= [who=@p coll=@tas post=@tas] |= [who=@p coll=@tas post=@tas]
@ -1196,12 +1217,12 @@
?& =(who our.bol) ?& =(who our.bol)
=(coll coll.act) =(coll coll.act)
== ==
=/ wir=wire /collection/[coll.act]
:_ %= this :_ %= this
subs.sat (~(del by subs.sat) who.act coll.act) subs.sat (~(del by subs.sat) who.act coll.act)
latest.sat new-latest latest.sat new-latest
outgoing.sat (~(del by outgoing.sat) wir)
== ==
:- [ost.bol %pull wir [who.act %write] ~] :- [u.bon %pull wir [who.act %write] ~]
%+ welp make-tile-moves %+ welp make-tile-moves
%+ turn (prey:pubsub:userlib /primary bol) %+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *] |= [b=bone *]
@ -1371,7 +1392,7 @@
[~ this] [~ this]
:: ::
[%collection @t ~] [%collection @t ~]
=/ coll=@tas i.wir =/ coll=@tas i.t.wir
=/ col=(unit collection) (~(get by pubs.sat) coll) =/ col=(unit collection) (~(get by pubs.sat) coll)
?~ col ?~ col
[~ this] [~ this]
@ -1399,7 +1420,7 @@
=/ new=collection =/ new=collection
u.col(subscribers (~(put in subscribers.u.col) src.bol)) u.col(subscribers (~(put in subscribers.u.col) src.bol))
=/ rum=rumor =/ rum=rumor
[%total our.bol coll u.col] [%total our.bol coll new]
:_ this(pubs.sat (~(put by pubs.sat) coll new)) :_ this(pubs.sat (~(put by pubs.sat) coll new))
[ost.bol %diff %write-rumor rum]~ [ost.bol %diff %write-rumor rum]~
:: ::

View File

@ -163,6 +163,8 @@
|= who=@p |= who=@p
^- json ^- json
(ship:enjs:format who) (ship:enjs:format who)
::
[%last-update (time:enjs:format last-update.col)]
== ==
:: ::
++ state-to-json ++ state-to-json

View File

@ -99,6 +99,7 @@
order=[pin=(list @tas) unpin=(list @tas)] order=[pin=(list @tas) unpin=(list @tas)]
contributors=[mod=?(%white %black) who=(set @p)] contributors=[mod=?(%white %black) who=(set @p)]
subscribers=(set @p) subscribers=(set @p)
last-update=@da
== ==
:: ::
+$ state +$ state
@ -108,6 +109,7 @@
latest=(list [who=ship coll=@tas post=@tas]) latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas]) unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t) invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
== ==
:: ::
+$ delta +$ delta