mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-08 12:11:42 +02:00
negentropy: refactor for allowing different types of storage.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/greatroar/blobloom"
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
"github.com/nbd-wtf/go-nostr/nip77/negentropy"
|
||||
"github.com/nbd-wtf/go-nostr/nip77/negentropy/storage/vector"
|
||||
)
|
||||
|
||||
func NegentropySync(ctx context.Context, store nostr.RelayStore, url string, filter nostr.Filter) error {
|
||||
@@ -19,10 +20,12 @@ func NegentropySync(ctx context.Context, store nostr.RelayStore, url string, fil
|
||||
return fmt.Errorf("failed to query our local store: %w", err)
|
||||
}
|
||||
|
||||
neg := negentropy.NewNegentropy(negentropy.NewVector(), 1024*1024)
|
||||
vec := vector.New()
|
||||
neg := negentropy.New(vec, 1024*1024)
|
||||
for _, evt := range data {
|
||||
neg.Insert(evt)
|
||||
vec.Insert(evt.CreatedAt, evt.ID)
|
||||
}
|
||||
vec.Seal()
|
||||
|
||||
result := make(chan error)
|
||||
|
||||
|
Reference in New Issue
Block a user