cache.go raw
1 package main
2
3 import "common/jsbridge/idb"
4
5 // Cache domain — pure event storage via IndexedDB.
6 // Knows nothing about subscriptions, relays, or encryption.
7
8 // cacheQuery queries IDB for events matching a filter.
9 func cacheQuery(filterRaw string, cb func(string)) {
10 idb.QueryEvents(filterRaw, cb)
11 }
12
13 // cacheStore saves an event to IDB.
14 func cacheStore(evJSON string, cb func(bool)) {
15 idb.SaveEvent(evJSON, cb)
16 }
17
18 // cacheSaveDM saves a DM record to IDB.
19 func cacheSaveDM(dmJSON string, cb func(string)) {
20 idb.SaveDM(dmJSON, cb)
21 }
22
23 // cacheGetConversationList retrieves the DM conversation list.
24 func cacheGetConversationList(cb func(string)) {
25 idb.GetConversationList(cb)
26 }
27
28 // cacheQueryDMs queries DM history for a peer.
29 func cacheQueryDMs(peer string, limit int, until int64, cb func(string)) {
30 idb.QueryDMs(peer, limit, until, cb)
31 }
32