mmm: Rescan()

This commit is contained in:
fiatjaf
2025-10-14 00:19:52 +00:00
parent 776a82ba7f
commit 95c70e3225
3 changed files with 234 additions and 5 deletions

View File

@@ -293,6 +293,13 @@ func (b *MultiMmapManager) loadEvent(pos position, eventReceiver *nostr.Event) e
return betterbinary.Unmarshal(b.mmapf[pos.start:pos.start+uint64(pos.size)], eventReceiver)
}
func (b *MultiMmapManager) loadJustTimestamp(pos position) (nostr.Timestamp, error) {
if len(b.mmapf) < int(pos.start+uint64(pos.size)) {
return 0, fmt.Errorf("out of bounds")
}
return betterbinary.GetCreatedAt(b.mmapf[pos.start : pos.start+uint64(pos.size)]), nil
}
// getNextAvailableLayerId iterates through all existing layers to find a vacant id
func (b *MultiMmapManager) getNextAvailableLayerId(txn *lmdb.Txn) (uint16, error) {
cursor, err := txn.OpenCursor(b.knownLayers)