sdk: EraseAccessTime and EraseEventRelays.

This commit is contained in:
fiatjaf
2025-09-24 11:23:21 -03:00
parent 71978f2bc2
commit 59bd3c29ff
2 changed files with 14 additions and 7 deletions

View File

@@ -49,3 +49,8 @@ func (sys *System) GetEventAccessTime(id nostr.ID) nostr.Timestamp {
return decodeEventAccessTime(data) return decodeEventAccessTime(data)
} }
func (sys *System) EraseAccessTime(id nostr.ID) error {
key := makeEventAccessTimeKey(id)
return sys.KVStore.Delete(key)
}

View File

@@ -104,18 +104,20 @@ func (sys *System) trackEventRelay(id nostr.ID, relay string, onlyIfItExists boo
// GetEventRelays returns all known relay URLs an event is known to be available on. // GetEventRelays returns all known relay URLs an event is known to be available on.
// It is based on information kept on KVStore. // It is based on information kept on KVStore.
func (sys *System) GetEventRelays(id nostr.ID) ([]string, error) { func (sys *System) GetEventRelays(id nostr.ID) []string {
// get the key for this event // get the key for this event
key := makeEventRelayKey(id) key := makeEventRelayKey(id)
// get stored relay list // get stored relay list
data, err := sys.KVStore.Get(key) data, _ := sys.KVStore.Get(key)
if err != nil {
return nil, err
}
if data == nil { if data == nil {
return nil, nil return nil
} }
return decodeRelayList(data), nil return decodeRelayList(data)
}
func (sys *System) EraseEventRelays(id nostr.ID) error {
key := makeEventRelayKey(id)
return sys.KVStore.Delete(key)
} }