lmdb: use 8-byte keys instead of 32, use indexAddr, migrations.

This commit is contained in:
fiatjaf
2023-12-06 06:48:16 -03:00
parent e3ddc80a08
commit f2cccb0fce
8 changed files with 254 additions and 120 deletions

View File

@@ -5,6 +5,7 @@ import (
"log"
"github.com/dgraph-io/badger/v4"
"github.com/fiatjaf/eventstore"
)
func (b *BadgerBackend) runMigrations() error {
@@ -74,7 +75,7 @@ func (b *BadgerBackend) runMigrations() error {
item := it.Item()
key := item.Key()
if kind, pkb, d := getAddrTagElements(string(key[1 : len(key)-4-4])); len(pkb) == 32 {
if kind, pkb, d := eventstore.GetAddrTagElements(string(key[1 : len(key)-4-4])); len(pkb) == 32 {
// it's an 'a' tag or alike
if err := txn.Delete(key); err != nil {
return err