Remove Dgraph support from the codebase.
Some checks failed
Go / build-and-release (push) Has been cancelled

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.
This commit is contained in:
2025-12-03 19:33:37 +00:00
parent 7a27c44bc9
commit 59247400dc
6 changed files with 6 additions and 58 deletions

View File

@@ -42,7 +42,6 @@ type BenchmarkConfig struct {
NetRate int // events/sec per worker NetRate int // events/sec per worker
// Backend selection // Backend selection
UseDgraph bool
UseNeo4j bool UseNeo4j bool
UseRelySQLite bool UseRelySQLite bool
} }
@@ -115,12 +114,6 @@ func main() {
return return
} }
if config.UseDgraph {
// Run dgraph benchmark
runDgraphBenchmark(config)
return
}
if config.UseNeo4j { if config.UseNeo4j {
// Run Neo4j benchmark // Run Neo4j benchmark
runNeo4jBenchmark(config) runNeo4jBenchmark(config)
@@ -152,28 +145,6 @@ func main() {
benchmark.GenerateAsciidocReport() 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) { func runNeo4jBenchmark(config *BenchmarkConfig) {
fmt.Printf("Starting Nostr Relay Benchmark (Neo4j Backend)\n") fmt.Printf("Starting Nostr Relay Benchmark (Neo4j Backend)\n")
fmt.Printf("Data Directory: %s\n", config.DataDir) 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") flag.IntVar(&config.NetRate, "net-rate", 20, "Events per second per worker")
// Backend selection // Backend selection
flag.BoolVar(
&config.UseDgraph, "dgraph", false,
"Use dgraph backend (requires Docker)",
)
flag.BoolVar( flag.BoolVar(
&config.UseNeo4j, "neo4j", false, &config.UseNeo4j, "neo4j", false,
"Use Neo4j backend (requires Docker)", "Use Neo4j backend (requires Docker)",

View File

@@ -31,7 +31,7 @@ type DatabaseConfig struct {
} }
// NewDatabase creates a database instance based on the specified type. // NewDatabase creates a database instance based on the specified type.
// Supported types: "badger", "dgraph", "neo4j" // Supported types: "badger", "neo4j"
func NewDatabase( func NewDatabase(
ctx context.Context, ctx context.Context,
cancel context.CancelFunc, cancel context.CancelFunc,

View File

@@ -24,9 +24,6 @@ type DatabaseConfig struct {
QueryCacheMaxAge time.Duration // ORLY_QUERY_CACHE_MAX_AGE QueryCacheMaxAge time.Duration // ORLY_QUERY_CACHE_MAX_AGE
InlineEventThreshold int // ORLY_INLINE_EVENT_THRESHOLD InlineEventThreshold int // ORLY_INLINE_EVENT_THRESHOLD
// DGraph-specific settings
DgraphURL string // ORLY_DGRAPH_URL
// Neo4j-specific settings // Neo4j-specific settings
Neo4jURI string // ORLY_NEO4J_URI Neo4jURI string // ORLY_NEO4J_URI
Neo4jUser string // ORLY_NEO4J_USER Neo4jUser string // ORLY_NEO4J_USER
@@ -34,7 +31,7 @@ type DatabaseConfig struct {
} }
// NewDatabase creates a database instance based on the specified type. // 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 // Note: "badger" is not available in WASM builds due to filesystem dependencies
func NewDatabase( func NewDatabase(
ctx context.Context, 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 nil, fmt.Errorf("wasmdb database backend not available (import _ \"next.orly.dev/pkg/wasmdb\")")
} }
return newWasmDBDatabase(ctx, cancel, cfg) 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": case "neo4j":
// Use the neo4j implementation (HTTP-based, works in WASM) // Use the neo4j implementation (HTTP-based, works in WASM)
if newNeo4jDatabase == nil { if newNeo4jDatabase == nil {
@@ -80,20 +71,10 @@ func NewDatabaseWithConfig(
} }
return newNeo4jDatabase(ctx, cancel, cfg) return newNeo4jDatabase(ctx, cancel, cfg)
default: 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 // newNeo4jDatabase creates a neo4j database instance
// This is defined here to avoid import cycles // This is defined here to avoid import cycles
var newNeo4jDatabase func(context.Context, context.CancelFunc, *DatabaseConfig) (Database, error) var newNeo4jDatabase func(context.Context, context.CancelFunc, *DatabaseConfig) (Database, error)

View File

@@ -13,7 +13,7 @@ import (
) )
// Database defines the interface that all database implementations must satisfy. // 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 { type Database interface {
// Core lifecycle methods // Core lifecycle methods
Path() string Path() string

View File

@@ -10,7 +10,7 @@ import (
"lol.mleku.dev/log" "lol.mleku.dev/log"
) )
// NewLogger creates a new dgraph logger. // NewLogger creates a new neo4j logger.
func NewLogger(logLevel int, label string) (l *logger) { func NewLogger(logLevel int, label string) (l *logger) {
l = &logger{Label: label} l = &logger{Label: label}
l.Level.Store(int32(logLevel)) l.Level.Store(int32(logLevel))

View File

@@ -1 +1 @@
v0.32.4 v0.32.5