From cc3fe23ae4b16c645dfe740cbe8a8729b84e34b0 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 10 Sep 2021 13:45:23 +1000 Subject: [PATCH] hark-store: add time field to %seen-index --- pkg/garden/app/hark-store.hoon | 20 +++++++++++--------- pkg/garden/lib/hark/store.hoon | 9 ++++++++- pkg/garden/sur/hark-store.hoon | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/pkg/garden/app/hark-store.hoon b/pkg/garden/app/hark-store.hoon index ee8b2e839..fcb924574 100644 --- a/pkg/garden/app/hark-store.hoon +++ b/pkg/garden/app/hark-store.hoon @@ -78,6 +78,8 @@ +* this . ha ~(. +> bowl) def ~(. (default-agent this %|) bowl) + io ~(. agentio bowl) + pass pass:io :: ++ on-init =. current-timebox now.bowl @@ -90,12 +92,13 @@ !<(versioned-state old-vase) =| cards=(list card) |^ ^- (quip card _this) - ?+ -.old !! - %8 + ?: ?=(%8 -.old) =. -.state old =. +.state inflate :_(this (flop cards)) - == + :: + :_ this + (poke-our:pass %hark-graph-hook hark-graph-migrate+old-vase)^~ ++ index-timebox |= [time=(unit @da) =timebox:store out=_by-place] ^+ by-place @@ -312,7 +315,7 @@ :: ++ unread-each |= [=place:store =path] - =. poke-core (seen-index place) + =. poke-core (seen-index place ~) =. poke-core (give %unread-each place path) %+ jub-place place |=(=stats:store stats(each (~(put in each.stats) path))) @@ -358,8 +361,7 @@ |= [=place:store inc=? count=@ud] =. poke-core (give %unread-count place inc count) - =. poke-core - (seen-index place) + =. poke-core (seen-index place ~) =/ f ?: inc (cury add count) (curr sub count) @@ -383,10 +385,10 @@ $(poke-core core, bins t.bins) :: ++ seen-index - |= =place:store - =. poke-core (give %seen-index place) + |= [=place:store time=(unit time)] + =. poke-core (give %seen-index place time) %+ jub-place place - |=(=stats:store stats(last now.bowl)) + |=(=stats:store stats(last (fall time now.bowl))) :: ++ seen =. poke-core diff --git a/pkg/garden/lib/hark/store.hoon b/pkg/garden/lib/hark/store.hoon index 492ecb989..735a0ddda 100644 --- a/pkg/garden/lib/hark/store.hoon +++ b/pkg/garden/lib/hark/store.hoon @@ -20,13 +20,20 @@ %read-count (place +.upd) %unread-each (read-each +.upd) %unread-count (unread-count +.upd) - %seen-index (place +.upd) + %seen-index (seen-index +.upd) %all-stats (all-stats +.upd) ::%read-note (index +.upd) ::%note-read (note-read +.upd) %archive (archive +.upd) == :: + ++ seen-index + |= [p=^place t=(unit ^time)] + %- pairs + :~ place+(place p) + time+?~(t ~ (time u.t)) + == + :: ++ archive |= [t=(unit @da) b=^bin] %- pairs diff --git a/pkg/garden/sur/hark-store.hoon b/pkg/garden/sur/hark-store.hoon index 9ab8251cf..0368e7fe9 100644 --- a/pkg/garden/sur/hark-store.hoon +++ b/pkg/garden/sur/hark-store.hoon @@ -97,7 +97,7 @@ :: %unread-each: Add .path to list of unreads for .place [%unread-each =place =path] :: %seen-index: Update last-updated for .place to now.bowl - [%seen-index =place] + [%seen-index =place time=(unit time)] :: store actions :: :: %archive: archive single notification