2020-11-24 05:20:44 +03:00
|
|
|
:: hark-store: notifications and unread counts [landscape]
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2020-11-24 05:20:44 +03:00
|
|
|
:: hark-store can store unread counts differently, depending on the
|
|
|
|
:: resource.
|
|
|
|
:: - last seen. This way, hark-store simply stores an index into
|
|
|
|
:: graph-store, which represents the last "seen" item, useful for
|
|
|
|
:: high-volume applications which are intrinsically time-ordered. i.e.
|
|
|
|
:: chats, comments
|
|
|
|
:: - each. Hark-store will store an index for each item that is unread.
|
|
|
|
:: Usefull for non-linear, low-volume applications, i.e. blogs,
|
|
|
|
:: collections
|
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
/- store=hark-store
|
|
|
|
/+ verb, dbug, default-agent, re=hark-unreads, agentio
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2020-11-24 05:20:44 +03:00
|
|
|
::
|
2020-12-05 07:32:17 +03:00
|
|
|
~% %hark-store-top ..part ~
|
2020-10-21 08:54:59 +03:00
|
|
|
|%
|
|
|
|
+$ card card:agent:gall
|
|
|
|
+$ versioned-state
|
2021-09-06 06:22:25 +03:00
|
|
|
$% state-2
|
2021-01-11 02:51:53 +03:00
|
|
|
state-3
|
2021-02-04 04:39:59 +03:00
|
|
|
state-4
|
2021-03-02 05:43:51 +03:00
|
|
|
state-5
|
2021-03-18 10:02:39 +03:00
|
|
|
state-6
|
2021-04-28 07:57:53 +03:00
|
|
|
state-7
|
2021-09-06 06:22:25 +03:00
|
|
|
state-8
|
2020-10-21 08:54:59 +03:00
|
|
|
==
|
|
|
|
::
|
2021-03-18 10:02:39 +03:00
|
|
|
+$ base-state
|
2021-09-06 06:22:25 +03:00
|
|
|
$: places=(map place:store stats:store)
|
|
|
|
=unreads:store
|
|
|
|
=reads:store
|
2020-11-24 05:20:44 +03:00
|
|
|
current-timebox=@da
|
2020-10-21 08:54:59 +03:00
|
|
|
==
|
2020-12-16 07:22:23 +03:00
|
|
|
::
|
2021-01-11 02:51:53 +03:00
|
|
|
+$ state-2
|
2021-09-06 06:22:25 +03:00
|
|
|
[%2 *]
|
2021-01-11 02:51:53 +03:00
|
|
|
::
|
|
|
|
+$ state-3
|
2021-09-06 06:22:25 +03:00
|
|
|
[%3 *]
|
2021-02-04 04:39:59 +03:00
|
|
|
::
|
|
|
|
+$ state-4
|
2021-09-06 06:22:25 +03:00
|
|
|
[%4 *]
|
2021-01-11 02:51:53 +03:00
|
|
|
::
|
2021-03-02 05:43:51 +03:00
|
|
|
+$ state-5
|
2021-09-06 06:22:25 +03:00
|
|
|
[%5 *]
|
2021-03-18 10:02:39 +03:00
|
|
|
::
|
|
|
|
+$ state-6
|
2021-09-06 06:22:25 +03:00
|
|
|
[%6 *]
|
2021-04-28 07:57:53 +03:00
|
|
|
::
|
|
|
|
+$ state-7
|
2021-09-06 06:22:25 +03:00
|
|
|
[%7 *]
|
2021-03-02 05:43:51 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
+$ state-8
|
|
|
|
[%8 base-state]
|
|
|
|
::
|
|
|
|
::
|
|
|
|
+$ cached-state
|
|
|
|
$: by-place=(jug place:store [time=(unit @da) =path])
|
|
|
|
~
|
|
|
|
==
|
|
|
|
+$ inflated-state
|
|
|
|
[state-8 cached-state]
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2020-11-16 06:52:45 +03:00
|
|
|
++ orm ((ordered-map @da timebox:store) gth)
|
2020-10-21 08:54:59 +03:00
|
|
|
--
|
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
=| inflated-state
|
2020-10-21 08:54:59 +03:00
|
|
|
=* state -
|
|
|
|
::
|
|
|
|
=<
|
2020-12-01 08:46:28 +03:00
|
|
|
%+ verb |
|
2020-10-21 08:54:59 +03:00
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
|
|
|
~% %hark-store-agent ..card ~
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
ha ~(. +> bowl)
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
::
|
|
|
|
++ on-init
|
2021-09-06 06:22:25 +03:00
|
|
|
=. current-timebox now.bowl
|
|
|
|
`this
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ on-save !>(-.state)
|
2020-10-21 08:54:59 +03:00
|
|
|
++ on-load
|
2020-10-27 08:07:13 +03:00
|
|
|
|= =old=vase
|
|
|
|
=/ old
|
2020-11-24 05:20:44 +03:00
|
|
|
!<(versioned-state old-vase)
|
|
|
|
=| cards=(list card)
|
2021-09-06 06:22:25 +03:00
|
|
|
|^ ^- (quip card _this)
|
|
|
|
?+ -.old !!
|
|
|
|
%8
|
|
|
|
=. -.state old
|
|
|
|
=. +.state inflate
|
|
|
|
:_(this (flop cards))
|
2020-11-24 05:20:44 +03:00
|
|
|
==
|
2021-09-06 06:22:25 +03:00
|
|
|
++ index-timebox
|
|
|
|
|= [time=(unit @da) =timebox:store out=_by-place]
|
|
|
|
^+ by-place
|
|
|
|
%+ roll ~(tap by timebox)
|
|
|
|
|= [[=bin:store =notification:store] out=_out]
|
|
|
|
(~(put ju out) place.bin [time path.bin])
|
|
|
|
::
|
|
|
|
++ index-reads
|
|
|
|
^+ by-place
|
|
|
|
%+ roll (tap:orm reads)
|
|
|
|
|= [[=time =timebox:store] out=_by-place]
|
|
|
|
(index-timebox `time timebox out)
|
|
|
|
::
|
|
|
|
++ inflate
|
|
|
|
=. by-place index-reads
|
|
|
|
=. by-place (index-timebox ~ unreads by-place)
|
|
|
|
+.state
|
2020-12-10 08:19:46 +03:00
|
|
|
--
|
2020-10-27 08:07:13 +03:00
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
2020-11-24 05:20:44 +03:00
|
|
|
?> (team:title [src our]:bowl)
|
2020-10-27 08:07:13 +03:00
|
|
|
|^
|
|
|
|
?+ path (on-watch:def path)
|
2021-09-06 06:22:25 +03:00
|
|
|
[%notes ~] `this
|
2020-10-27 08:07:13 +03:00
|
|
|
::
|
|
|
|
[%updates ~]
|
|
|
|
:_ this
|
|
|
|
[%give %fact ~ hark-update+!>(initial-updates)]~
|
2021-09-06 06:22:25 +03:00
|
|
|
::
|
2020-10-27 08:07:13 +03:00
|
|
|
==
|
2020-11-10 06:32:48 +03:00
|
|
|
::
|
2020-10-27 08:07:13 +03:00
|
|
|
++ initial-updates
|
|
|
|
^- update:store
|
|
|
|
:- %more
|
|
|
|
^- (list update:store)
|
2021-09-06 06:22:25 +03:00
|
|
|
:~ [%timebox ~ ~(tap by unreads)]
|
|
|
|
[%all-stats places]
|
2021-02-22 03:47:38 +03:00
|
|
|
==
|
2020-10-27 08:07:13 +03:00
|
|
|
--
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2020-10-27 08:07:13 +03:00
|
|
|
++ on-peek
|
|
|
|
|= =path
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?+ path (on-peek:def path)
|
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
[%x %recent %inbox @ @ ~]
|
|
|
|
=/ date=@da
|
2020-10-27 08:07:13 +03:00
|
|
|
(slav %ud i.t.t.t.path)
|
2020-11-16 06:53:18 +03:00
|
|
|
=/ length=@ud
|
|
|
|
(slav %ud i.t.t.t.t.path)
|
2020-11-12 03:26:24 +03:00
|
|
|
:^ ~ ~ %hark-update
|
2020-11-03 03:36:00 +03:00
|
|
|
!> ^- update:store
|
|
|
|
:- %more
|
2021-09-06 06:22:25 +03:00
|
|
|
%+ turn (tab:orm reads `date length)
|
2020-11-03 03:36:00 +03:00
|
|
|
|= [time=@da =timebox:store]
|
|
|
|
^- update:store
|
2021-05-18 03:57:25 +03:00
|
|
|
[%timebox `time ~(tap by timebox)]
|
2020-10-27 08:07:13 +03:00
|
|
|
==
|
2020-11-10 06:32:48 +03:00
|
|
|
::
|
2020-10-21 08:54:59 +03:00
|
|
|
++ on-poke
|
|
|
|
~/ %hark-store-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
|^
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
=^ cards state
|
|
|
|
?+ mark (on-poke:def mark vase)
|
|
|
|
%hark-action (hark-action !<(action:store vase))
|
2021-01-11 02:51:53 +03:00
|
|
|
%noun (poke-noun !<(* vase))
|
2020-10-21 08:54:59 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
2021-01-11 02:51:53 +03:00
|
|
|
++ poke-noun
|
|
|
|
|= val=*
|
|
|
|
?+ val ~|(%bad-noun-poke !!)
|
|
|
|
%print ~&(+.state [~ state])
|
2021-09-06 06:22:25 +03:00
|
|
|
%clear `state(unreads ~, reads ~)
|
2021-01-11 02:51:53 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ poke-us
|
|
|
|
|= =action:store
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our dap]:bowl %poke hark-action+!>(action)]
|
|
|
|
::
|
2020-10-21 08:54:59 +03:00
|
|
|
++ hark-action
|
|
|
|
|= =action:store
|
|
|
|
^- (quip card _state)
|
2021-09-06 06:22:25 +03:00
|
|
|
abet:(abed:poke-engine:ha action)
|
2020-10-21 08:54:59 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ on-agent on-agent:def
|
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-arvo
|
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card _this)
|
|
|
|
?. ?=([%autoseen ~] wire)
|
|
|
|
(on-arvo:def wire sign-arvo)
|
2021-05-17 06:35:00 +03:00
|
|
|
`this
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* met ~(. metadata bowl)
|
2021-09-06 06:22:25 +03:00
|
|
|
io ~(. agentio bowl)
|
|
|
|
pass pass:io
|
2020-12-15 08:38:56 +03:00
|
|
|
++ poke-engine
|
2021-09-06 06:22:25 +03:00
|
|
|
|_ [out=(list update:store) cards=(list card)]
|
2020-12-15 08:38:56 +03:00
|
|
|
++ poke-core .
|
|
|
|
::
|
|
|
|
++ abed
|
2021-09-06 06:22:25 +03:00
|
|
|
|= in=action:store
|
2021-01-23 00:00:20 +03:00
|
|
|
?- -.in
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
%add-note (add-note +.in)
|
2021-09-06 06:22:25 +03:00
|
|
|
%del-place (del-place +.in)
|
2020-12-15 08:38:56 +03:00
|
|
|
%archive (do-archive +.in)
|
|
|
|
::
|
|
|
|
%unread-count (unread-count +.in)
|
|
|
|
%read-count (read-count +.in)
|
|
|
|
::
|
|
|
|
%read-each (read-each +.in)
|
|
|
|
%unread-each (unread-each +.in)
|
|
|
|
::
|
|
|
|
%read-note (read-note +.in)
|
|
|
|
::
|
|
|
|
%seen-index (seen-index +.in)
|
2021-05-25 06:38:09 +03:00
|
|
|
::
|
2020-12-15 08:38:56 +03:00
|
|
|
%seen seen
|
2021-09-06 06:22:25 +03:00
|
|
|
%archive-all archive-all
|
2021-01-23 00:00:20 +03:00
|
|
|
%read-all read-all
|
|
|
|
::
|
2020-12-15 08:38:56 +03:00
|
|
|
==
|
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ abet
|
|
|
|
^- (quip card _state)
|
|
|
|
:_ state
|
|
|
|
%+ snoc (flop cards)
|
|
|
|
[%give %fact ~[/updates] %hark-update !>([%more (flop out)])]
|
|
|
|
::
|
|
|
|
++ give |=(=update:store poke-core(out [update out]))
|
|
|
|
++ emit |=(=card poke-core(cards [card cards]))
|
|
|
|
::
|
|
|
|
::
|
2020-12-15 08:38:56 +03:00
|
|
|
:: +| %note
|
|
|
|
::
|
|
|
|
:: notification tracking
|
|
|
|
++ put-notifs
|
|
|
|
|= [time=@da =timebox:store]
|
2021-09-06 06:22:25 +03:00
|
|
|
poke-core(reads (put:orm reads time timebox))
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ add-note
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=bin:store =body:store]
|
2020-12-15 08:38:56 +03:00
|
|
|
^+ poke-core
|
2021-09-06 06:22:25 +03:00
|
|
|
=. poke-core
|
|
|
|
(emit (fact:io hark-update+!>([%add-note bin body]) /notes ~))
|
|
|
|
=. by-place
|
|
|
|
(~(put ju by-place) place.bin ~ path.bin)
|
2020-12-15 08:38:56 +03:00
|
|
|
=/ existing-notif
|
2021-09-06 06:22:25 +03:00
|
|
|
(~(gut by unreads) bin *notification:store)
|
2020-12-15 08:38:56 +03:00
|
|
|
=/ new=notification:store
|
2021-09-06 06:22:25 +03:00
|
|
|
[now.bowl bin (snoc body.existing-notif body)]
|
|
|
|
=. unreads
|
|
|
|
(~(put by unreads) bin new)
|
|
|
|
(give %added new)
|
|
|
|
::
|
|
|
|
++ del-place
|
|
|
|
|= =place:store
|
|
|
|
=/ notes=(list [time=(unit @da) =path])
|
|
|
|
~(tap in (~(get ju by-place) place))
|
|
|
|
|- ^+ poke-core
|
|
|
|
?~ notes poke-core
|
|
|
|
=/ core=_poke-core
|
|
|
|
(do-archive time.i.notes [path.i.notes place])
|
|
|
|
$(poke-core core, notes t.notes)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ do-archive
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [time=(unit @da) =bin:store]
|
2020-12-15 08:38:56 +03:00
|
|
|
^+ poke-core
|
2021-09-06 06:22:25 +03:00
|
|
|
=. poke-core (give %archive time bin)
|
2021-05-17 06:35:00 +03:00
|
|
|
|^
|
|
|
|
?~(time archive-unread (archive-read u.time))
|
|
|
|
::
|
|
|
|
++ archive-unread
|
2021-09-06 06:22:25 +03:00
|
|
|
=. by-place (~(del ju by-place) place.bin ~ path.bin)
|
|
|
|
poke-core(unreads (~(del by unreads) bin))
|
2021-05-17 06:35:00 +03:00
|
|
|
::
|
|
|
|
++ archive-read
|
|
|
|
|= time=@da
|
2021-09-06 06:22:25 +03:00
|
|
|
%_ poke-core
|
|
|
|
by-place (~(del ju by-place) place.bin `time path.bin)
|
|
|
|
reads (~(del re reads) time bin)
|
|
|
|
==
|
2021-05-17 06:35:00 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ read-note
|
2021-09-06 06:22:25 +03:00
|
|
|
|= =bin:store
|
2021-05-17 06:35:00 +03:00
|
|
|
=/ =notification:store
|
2021-09-06 06:22:25 +03:00
|
|
|
(~(got by unreads) bin)
|
|
|
|
=. unreads
|
|
|
|
(~(del by unreads) bin)
|
2021-05-17 06:35:00 +03:00
|
|
|
=/ =time
|
2021-09-06 06:22:25 +03:00
|
|
|
(fall timebox:(gut-place place.bin) now.bowl)
|
|
|
|
=. date.notification time
|
|
|
|
=. reads (~(put re reads) time bin notification)
|
|
|
|
(give %note-read time bin)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
::
|
|
|
|
:: +| %each
|
|
|
|
::
|
|
|
|
:: each unread tracking
|
|
|
|
::
|
|
|
|
++ unread-each
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=place:store =path]
|
|
|
|
=. poke-core (seen-index place)
|
|
|
|
=. poke-core (give %unread-each place path)
|
|
|
|
%+ jub-place place
|
|
|
|
|=(=stats:store stats(each (~(put in each.stats) path)))
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ read-index-each
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=place:store =path]
|
|
|
|
%- read-bins
|
2020-12-15 08:38:56 +03:00
|
|
|
%+ skim
|
2021-09-06 06:22:25 +03:00
|
|
|
~(tap in ~(key by unreads))
|
|
|
|
|= =bin:store
|
|
|
|
?. =(place place.bin) %.n
|
2021-01-13 05:37:23 +03:00
|
|
|
=/ not=notification:store
|
2021-09-06 06:22:25 +03:00
|
|
|
(~(got by unreads) bin)
|
|
|
|
(lien body.not |=(=body:store =(binned.body path)))
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ read-each
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=place:store =path]
|
|
|
|
=. poke-core (read-index-each place path)
|
|
|
|
=. poke-core (give %read-each place path)
|
|
|
|
%+ jub-place place
|
|
|
|
|= =stats:store
|
|
|
|
%_ stats
|
|
|
|
timebox `now.bowl
|
|
|
|
each (~(del in each.stats) path)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ gut-place
|
|
|
|
|= =place:store
|
|
|
|
?: (~(has by places) place) (~(got by places) place)
|
|
|
|
=| def=stats:store
|
|
|
|
def(timebox ~, last now.bowl)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ jub-place
|
|
|
|
|= $: =place:store
|
|
|
|
f=$-(stats:store stats:store)
|
2020-12-15 08:38:56 +03:00
|
|
|
==
|
2021-09-06 06:22:25 +03:00
|
|
|
^+ poke-core
|
|
|
|
=/ =stats:store
|
|
|
|
(gut-place place)
|
|
|
|
poke-core(places (~(put by places) place (f stats)))
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ unread-count
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=place:store inc=? count=@ud]
|
|
|
|
=. poke-core
|
|
|
|
(give %unread-count place inc count)
|
|
|
|
=. poke-core
|
|
|
|
(seen-index place)
|
|
|
|
=/ f
|
|
|
|
?: inc (cury add count)
|
|
|
|
(curr sub count)
|
|
|
|
%+ jub-place place
|
|
|
|
|= =stats:store
|
|
|
|
stats(count (f count.stats))
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ read-count
|
2021-09-06 06:22:25 +03:00
|
|
|
|= =place:store
|
|
|
|
=. poke-core (give %read-count place)
|
|
|
|
%+ jub-place place
|
|
|
|
|= =stats:store
|
|
|
|
stats(count 0, timebox `now.bowl)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ read-bins
|
|
|
|
|= bins=(list bin:store)
|
2020-12-16 10:37:10 +03:00
|
|
|
|-
|
2021-09-06 06:22:25 +03:00
|
|
|
?~ bins poke-core
|
2020-12-16 10:37:10 +03:00
|
|
|
=/ core
|
2021-09-06 06:22:25 +03:00
|
|
|
(read-note i.bins)
|
|
|
|
$(poke-core core, bins t.bins)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
|
|
|
++ seen-index
|
2021-09-06 06:22:25 +03:00
|
|
|
|= =place:store
|
|
|
|
=. poke-core (give %seen-index place)
|
|
|
|
%+ jub-place place
|
|
|
|
|=(=stats:store stats(last now.bowl))
|
2020-12-17 09:10:26 +03:00
|
|
|
::
|
2020-12-15 08:38:56 +03:00
|
|
|
++ seen
|
2021-05-17 06:35:00 +03:00
|
|
|
=. poke-core
|
2021-09-06 06:22:25 +03:00
|
|
|
(read-bins ~(tap in ~(key by unreads)))
|
|
|
|
=. poke-core (turn-places |=(=stats:store stats(timebox ~)))
|
|
|
|
poke-core(current-timebox now.bowl)
|
2020-12-15 08:38:56 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ archive-all
|
|
|
|
=. poke-core (give:seen %archive-all ~)
|
|
|
|
poke-core(unreads ~, reads ~)
|
2021-01-23 00:00:20 +03:00
|
|
|
::
|
2021-09-06 06:22:25 +03:00
|
|
|
++ read-all
|
|
|
|
=. poke-core (give:seen %read-all ~)
|
|
|
|
=/ to-read=(list bin:store) ~(tap in ~(key by unreads))
|
|
|
|
|-
|
|
|
|
?~ to-read poke-core
|
|
|
|
=/ core=_poke-core (read-note i.to-read)
|
|
|
|
$(to-read t.to-read, poke-core core)
|
|
|
|
::
|
|
|
|
++ turn-places
|
|
|
|
|= f=$-(stats:store stats:store)
|
|
|
|
=/ places ~(tap in ~(key by places))
|
|
|
|
|- ^+ poke-core
|
|
|
|
?~ places poke-core
|
|
|
|
=/ core=_poke-core (jub-place i.places f)
|
|
|
|
$(poke-core core, places t.places)
|
2020-12-15 08:38:56 +03:00
|
|
|
--
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
|
|
|
++ merge-notification
|
2020-12-15 08:38:56 +03:00
|
|
|
|= [existing=(unit notification:store) new=notification:store]
|
2020-10-21 08:54:59 +03:00
|
|
|
^- notification:store
|
2020-12-15 08:38:56 +03:00
|
|
|
?~ existing new
|
2021-09-06 06:22:25 +03:00
|
|
|
[(max date.u.existing date.new) bin.new (welp body.u.existing body.new)]
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
2020-10-27 08:07:13 +03:00
|
|
|
:: +key-orm: +key:by for ordered maps
|
|
|
|
++ key-orm
|
2021-09-06 06:22:25 +03:00
|
|
|
|= =reads:store
|
2020-10-27 08:07:13 +03:00
|
|
|
^- (list @da)
|
2021-09-06 06:22:25 +03:00
|
|
|
(turn (tap:orm reads) |=([@da *] +<-))
|
|
|
|
::
|
2020-10-22 04:30:37 +03:00
|
|
|
:: +gut-orm: +gut:by for ordered maps
|
|
|
|
:: TODO: move to zuse.hoon
|
2020-10-21 08:54:59 +03:00
|
|
|
++ gut-orm
|
2021-09-06 06:22:25 +03:00
|
|
|
|= [=reads:store time=@da]
|
2020-10-21 08:54:59 +03:00
|
|
|
^- timebox:store
|
2021-09-06 06:22:25 +03:00
|
|
|
(fall (get:orm reads time) ~)
|
2020-10-21 08:54:59 +03:00
|
|
|
::
|
|
|
|
::
|
2020-11-24 05:20:44 +03:00
|
|
|
++ scry
|
|
|
|
|* [=mold p=path]
|
|
|
|
?> ?=(^ p)
|
|
|
|
?> ?=(^ t.p)
|
|
|
|
.^(mold i.p (scot %p our.bowl) i.t.p (scot %da now.bowl) t.t.p)
|
|
|
|
::
|
2020-10-21 08:54:59 +03:00
|
|
|
++ give
|
|
|
|
|= [paths=(list path) update=update:store]
|
|
|
|
^- (list card)
|
2020-10-27 08:07:13 +03:00
|
|
|
[%give %fact paths [%hark-update !>(update)]]~
|
|
|
|
::
|
2020-12-15 08:38:56 +03:00
|
|
|
++ tap-nonempty
|
2021-09-06 06:22:25 +03:00
|
|
|
|= =reads:store
|
2020-12-15 08:38:56 +03:00
|
|
|
^- (list [@da timebox:store])
|
2021-09-06 06:22:25 +03:00
|
|
|
%+ skim (tap:orm reads)
|
2020-12-15 08:38:56 +03:00
|
|
|
|=([@da =timebox:store] !=(~(wyt by timebox) 0))
|
2020-10-21 08:54:59 +03:00
|
|
|
--
|