From 59247400dcfac4c0a2e06f1005fbd0eeb846e031 Mon Sep 17 00:00:00 2001 From: mleku Date: Wed, 3 Dec 2025 19:33:37 +0000 Subject: [PATCH] Remove Dgraph support from the codebase. Dgraph-related functionality, configuration, and benchmarks have been removed from the project. This streamlines the codebase to focus on supported backends, specifically eliminating Dgraph references in favor of Neo4j and other implementations. Version bumped to reflect the changes. --- cmd/benchmark/main.go | 33 --------------------------------- pkg/database/factory.go | 2 +- pkg/database/factory_wasm.go | 23 ++--------------------- pkg/database/interface.go | 2 +- pkg/neo4j/logger.go | 2 +- pkg/version/version | 2 +- 6 files changed, 6 insertions(+), 58 deletions(-) diff --git a/cmd/benchmark/main.go b/cmd/benchmark/main.go index e493b73..abfa5dc 100644 --- a/cmd/benchmark/main.go +++ b/cmd/benchmark/main.go @@ -42,7 +42,6 @@ type BenchmarkConfig struct { NetRate int // events/sec per worker // Backend selection - UseDgraph bool UseNeo4j bool UseRelySQLite bool } @@ -115,12 +114,6 @@ func main() { return } - if config.UseDgraph { - // Run dgraph benchmark - runDgraphBenchmark(config) - return - } - if config.UseNeo4j { // Run Neo4j benchmark runNeo4jBenchmark(config) @@ -152,28 +145,6 @@ func main() { benchmark.GenerateAsciidocReport() } -func runDgraphBenchmark(config *BenchmarkConfig) { - fmt.Printf("Starting Nostr Relay Benchmark (Dgraph Backend)\n") - fmt.Printf("Data Directory: %s\n", config.DataDir) - fmt.Printf( - "Events: %d, Workers: %d\n", - config.NumEvents, config.ConcurrentWorkers, - ) - - dgraphBench, err := NewDgraphBenchmark(config) - if err != nil { - log.Fatalf("Failed to create dgraph benchmark: %v", err) - } - defer dgraphBench.Close() - - // Run dgraph benchmark suite - dgraphBench.RunSuite() - - // Generate reports - dgraphBench.GenerateReport() - dgraphBench.GenerateAsciidocReport() -} - func runNeo4jBenchmark(config *BenchmarkConfig) { fmt.Printf("Starting Nostr Relay Benchmark (Neo4j Backend)\n") fmt.Printf("Data Directory: %s\n", config.DataDir) @@ -254,10 +225,6 @@ func parseFlags() *BenchmarkConfig { flag.IntVar(&config.NetRate, "net-rate", 20, "Events per second per worker") // Backend selection - flag.BoolVar( - &config.UseDgraph, "dgraph", false, - "Use dgraph backend (requires Docker)", - ) flag.BoolVar( &config.UseNeo4j, "neo4j", false, "Use Neo4j backend (requires Docker)", diff --git a/pkg/database/factory.go b/pkg/database/factory.go index bbcef51..86fdcb3 100644 --- a/pkg/database/factory.go +++ b/pkg/database/factory.go @@ -31,7 +31,7 @@ type DatabaseConfig struct { } // NewDatabase creates a database instance based on the specified type. -// Supported types: "badger", "dgraph", "neo4j" +// Supported types: "badger", "neo4j" func NewDatabase( ctx context.Context, cancel context.CancelFunc, diff --git a/pkg/database/factory_wasm.go b/pkg/database/factory_wasm.go index 07d4876..e790396 100644 --- a/pkg/database/factory_wasm.go +++ b/pkg/database/factory_wasm.go @@ -24,9 +24,6 @@ type DatabaseConfig struct { QueryCacheMaxAge time.Duration // ORLY_QUERY_CACHE_MAX_AGE InlineEventThreshold int // ORLY_INLINE_EVENT_THRESHOLD - // DGraph-specific settings - DgraphURL string // ORLY_DGRAPH_URL - // Neo4j-specific settings Neo4jURI string // ORLY_NEO4J_URI Neo4jUser string // ORLY_NEO4J_USER @@ -34,7 +31,7 @@ type DatabaseConfig struct { } // NewDatabase creates a database instance based on the specified type. -// Supported types in WASM: "wasmdb", "dgraph", "neo4j" +// Supported types in WASM: "wasmdb", "neo4j" // Note: "badger" is not available in WASM builds due to filesystem dependencies func NewDatabase( ctx context.Context, @@ -67,12 +64,6 @@ func NewDatabaseWithConfig( return nil, fmt.Errorf("wasmdb database backend not available (import _ \"next.orly.dev/pkg/wasmdb\")") } return newWasmDBDatabase(ctx, cancel, cfg) - case "dgraph": - // Use the dgraph implementation (HTTP-based, works in WASM) - if newDgraphDatabase == nil { - return nil, fmt.Errorf("dgraph database backend not available (import _ \"next.orly.dev/pkg/dgraph\")") - } - return newDgraphDatabase(ctx, cancel, cfg) case "neo4j": // Use the neo4j implementation (HTTP-based, works in WASM) if newNeo4jDatabase == nil { @@ -80,20 +71,10 @@ func NewDatabaseWithConfig( } return newNeo4jDatabase(ctx, cancel, cfg) default: - return nil, fmt.Errorf("unsupported database type: %s (supported in WASM: wasmdb, dgraph, neo4j)", dbType) + return nil, fmt.Errorf("unsupported database type: %s (supported in WASM: wasmdb, neo4j)", dbType) } } -// newDgraphDatabase creates a dgraph database instance -// This is defined here to avoid import cycles -var newDgraphDatabase func(context.Context, context.CancelFunc, *DatabaseConfig) (Database, error) - -// RegisterDgraphFactory registers the dgraph database factory -// This is called from the dgraph package's init() function -func RegisterDgraphFactory(factory func(context.Context, context.CancelFunc, *DatabaseConfig) (Database, error)) { - newDgraphDatabase = factory -} - // newNeo4jDatabase creates a neo4j database instance // This is defined here to avoid import cycles var newNeo4jDatabase func(context.Context, context.CancelFunc, *DatabaseConfig) (Database, error) diff --git a/pkg/database/interface.go b/pkg/database/interface.go index 1593101..f841eb2 100644 --- a/pkg/database/interface.go +++ b/pkg/database/interface.go @@ -13,7 +13,7 @@ import ( ) // Database defines the interface that all database implementations must satisfy. -// This allows switching between different storage backends (badger, dgraph, etc.) +// This allows switching between different storage backends (badger, neo4j, etc.) type Database interface { // Core lifecycle methods Path() string diff --git a/pkg/neo4j/logger.go b/pkg/neo4j/logger.go index afce78b..a6017cc 100644 --- a/pkg/neo4j/logger.go +++ b/pkg/neo4j/logger.go @@ -10,7 +10,7 @@ import ( "lol.mleku.dev/log" ) -// NewLogger creates a new dgraph logger. +// NewLogger creates a new neo4j logger. func NewLogger(logLevel int, label string) (l *logger) { l = &logger{Label: label} l.Level.Store(int32(logLevel)) diff --git a/pkg/version/version b/pkg/version/version index 35d830c..2cf488d 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.32.4 \ No newline at end of file +v0.32.5 \ No newline at end of file