hark-store: fix cache coherency in +opened
^+ poke-core
=. poke-core
(emit (fact:io hark-update+!>([%add-note bin body]) /notes ~))
- =. by-place
- (~(put ju by-place) place.bin unseen+~ path.bin)
=/ existing-notif
(~(gut by unseen) bin *notification:store)
=/ new=notification:store
[now.bowl bin [body body.existing-notif]]
- =. unseen
- (~(put by unseen) bin new)
+ =. poke-core
+ (put-lid unseen/~ bin new)
(give %added new)
::
++ del-place
=/ =notification:store (need (get-lid lid bin))
=. poke-core (del-lid lid bin)
=. poke-core (put-lid archive+now.bowl bin notification)
- =? poke-core ?=(%unseen -.lid)
- ?~ n=(get-lid seen+~ bin) poke-core
- =. archive
- %^ ~(job re archive) now.bowl bin
- |= og=(unit notification:store)
- (merge-notification og u.n)
- poke-core
(give %archived now.bowl lid notification)
::
++ read-note
|= =bin:store
=/ =notification:store
(~(got by unseen) bin)
- =. unseen
- (~(del by unseen) bin)
+ =. poke-core
+ (del-lid unseen/~ bin)
=/ =time
(fall timebox:(gut-place place.bin) now.bowl)
=. date.notification time
- =. archive (~(put re archive) time bin notification)
+ =. poke-core
+ (put-lid archive/time bin notification)
(give %note-read time bin)
::
::
poke-core
::
++ opened
- =. seen
- %- ~(gas by *timebox:store)
- %+ murn ~(tap in (~(uni in ~(key by seen)) ~(key by unseen)))
+ =. poke-core (turn-places |=(=stats:store stats(timebox ~)))
+ =. poke-core (give %opened ~)
+ %+ roll ~(tap in ~(key by unseen))
+ |= [=bin:store out=_poke-core]
+ (opened-note:out bin)
+ ::
+ ++ opened-note
|= =bin:store
+ ^+ poke-core
+ =/ old
+ (~(got by unseen) bin)
+ =. poke-core
+ (del-lid unseen/~ bin)
=/ se (~(get by seen) bin)
- =/ un (~(get by unseen) bin)
- ?~ un
- ?~(se ~ `[bin u.se])
- `[bin (merge-notification se u.un)]
- =. unseen ~
- =. poke-core (turn-places |=(=stats:store stats(timebox ~)))
- (give %opened ~)
+ %^ put-lid seen/~ bin
+ (merge-notification se old)
::
++ archive-all
