mirror of
https://github.com/aljazceru/crawler_v2.git
synced 2025-12-16 23:14:19 +01:00
using nastro instead of old eventstore
This commit is contained in:
@@ -8,13 +8,13 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/pippellia-btc/nastro"
|
||||
"github.com/pippellia-btc/slicex"
|
||||
"github.com/vertex-lab/crawler_v2/pkg/graph"
|
||||
"github.com/vertex-lab/crawler_v2/pkg/redb"
|
||||
"github.com/vertex-lab/crawler_v2/pkg/walks"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
"github.com/vertex-lab/relay/pkg/eventstore"
|
||||
)
|
||||
|
||||
type EngineConfig struct {
|
||||
@@ -44,7 +44,7 @@ func (c EngineConfig) Print() {
|
||||
func Engine(
|
||||
ctx context.Context,
|
||||
config EngineConfig,
|
||||
store *eventstore.Store,
|
||||
store nastro.Store,
|
||||
db redb.RedisDB,
|
||||
events chan *nostr.Event) {
|
||||
|
||||
@@ -72,7 +72,7 @@ func Engine(
|
||||
func Archiver(
|
||||
ctx context.Context,
|
||||
config EngineConfig,
|
||||
store *eventstore.Store,
|
||||
store nastro.Store,
|
||||
events chan *nostr.Event,
|
||||
onReplace func(*nostr.Event) error) {
|
||||
|
||||
@@ -204,7 +204,6 @@ func computeDelta(ctx context.Context, db redb.RedisDB, cache *walks.CachedWalke
|
||||
if err != nil {
|
||||
return graph.Delta{}, fmt.Errorf("failed to compute delta: %w", err)
|
||||
}
|
||||
|
||||
return graph.NewDelta(event.Kind, author.ID, oldFollows, newFollows), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
"github.com/vertex-lab/relay/pkg/eventstore"
|
||||
"github.com/pippellia-btc/nastro"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -257,7 +257,7 @@ func fetch(ctx context.Context, pool *nostr.SimplePool, relays, pubkeys []string
|
||||
func FetcherDB(
|
||||
ctx context.Context,
|
||||
config FetcherConfig,
|
||||
store *eventstore.Store,
|
||||
store nastro.Store,
|
||||
pubkeys <-chan string,
|
||||
send func(*nostr.Event) error) {
|
||||
|
||||
@@ -281,7 +281,7 @@ func FetcherDB(
|
||||
continue
|
||||
}
|
||||
|
||||
events, err := store.Query(ctx, &nostr.Filter{Kinds: Kinds, Authors: batch})
|
||||
events, err := store.Query(ctx, nostr.Filter{Kinds: Kinds, Authors: batch})
|
||||
if err != nil {
|
||||
log.Printf("FetcherDB: %v", err)
|
||||
}
|
||||
@@ -300,7 +300,7 @@ func FetcherDB(
|
||||
continue
|
||||
}
|
||||
|
||||
events, err := store.Query(ctx, &nostr.Filter{Kinds: Kinds, Authors: batch})
|
||||
events, err := store.Query(ctx, nostr.Filter{Kinds: Kinds, Authors: batch})
|
||||
if err != nil {
|
||||
log.Printf("FetcherDB: %v", err)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ func TestFirehose(t *testing.T) {
|
||||
|
||||
checker := mockChecker{pubkey: pip}
|
||||
config := NewFirehoseConfig()
|
||||
|
||||
Firehose(ctx, config, checker, print)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user