aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-04-16 09:53:44 -0500
committerRobin Jarry <robin@jarry.cc>2023-04-22 22:40:12 +0200
commit5b0a98b8c936532fa5444b1cabf53d7c929d19c1 (patch)
treeb04415f6120d944cd74c45464a771d064cdd4305 /lib
parentf13fbe7a27756c63d85f40c15320664d634f59e2 (diff)
downloadaerc-5b0a98b8c936532fa5444b1cabf53d7c929d19c1.tar.gz
directory: use directory to store rue counts
Store the Directory RUE counts on the Directory data model. Use DirectoryInfo messages to update the Directory model. Access Directories via the dirlist instead of via the msgstore. Remove unused fields on DirectoryInfo, all backends now give accurate counts. Move refetch logic into dirlist Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/dirstore.go4
-rw-r--r--lib/msgstore.go7
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/dirstore.go b/lib/dirstore.go
index 76833622..bbf4e20b 100644
--- a/lib/dirstore.go
+++ b/lib/dirstore.go
@@ -36,3 +36,7 @@ func (store *DirStore) Remove(name string) {
delete(store.dirs, name)
delete(store.msgStores, name)
}
+
+func (store *DirStore) Directory(name string) *models.Directory {
+ return store.dirs[name]
+}
diff --git a/lib/msgstore.go b/lib/msgstore.go
index f81851e2..8e0785a6 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -18,7 +18,6 @@ import (
type MessageStore struct {
sync.Mutex
Deleted map[uint32]interface{}
- DirInfo models.DirectoryInfo
Messages map[uint32]*models.MessageInfo
Sorting bool
@@ -215,12 +214,6 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
case *types.OpenDirectory:
store.Sort(store.sortCriteria, nil)
update = true
- case *types.DirectoryInfo:
- store.DirInfo = *msg.Info
- if msg.Refetch {
- store.Sort(store.sortCriteria, nil)
- update = true
- }
case *types.DirectoryContents:
newMap := make(map[uint32]*models.MessageInfo)
for _, uid := range msg.Uids {