mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-10 03:27:59 +00:00
Direct kuzu write done
This commit is contained in:
commit
f919f264c0
3 changed files with 43 additions and 0 deletions
|
|
@ -21,7 +21,10 @@ export interface FeatureFlags {
|
|||
enableKuzuDB: boolean;
|
||||
enableKuzuDBPersistence: boolean;
|
||||
enableKuzuDBPerformanceMonitoring: boolean;
|
||||
<<<<<<< HEAD
|
||||
enableKuzuDBDirectWrites: boolean;
|
||||
=======
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
|
||||
// Debug Features
|
||||
enableDebugMode: boolean;
|
||||
|
|
@ -47,7 +50,10 @@ export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
|
|||
enableKuzuDB: false,
|
||||
enableKuzuDBPersistence: false,
|
||||
enableKuzuDBPerformanceMonitoring: false,
|
||||
<<<<<<< HEAD
|
||||
enableKuzuDBDirectWrites: false,
|
||||
=======
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
|
||||
// Debug Features
|
||||
enableDebugMode: false,
|
||||
|
|
@ -115,6 +121,7 @@ class FeatureFlagManager {
|
|||
console.log(`⚠️ Warning: KuzuDB env var not recognized: "${kuzuEnabled}" - using default: ${flags.enableKuzuDB}`);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Handle KuzuDB Direct Writes settings
|
||||
let directWritesEnabled: string | undefined;
|
||||
try {
|
||||
|
|
@ -139,6 +146,8 @@ class FeatureFlagManager {
|
|||
console.log(`⚠️ Warning: KuzuDB direct writes env var not recognized: "${directWritesEnabled}" - using default: ${flags.enableKuzuDBDirectWrites}`);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
// Then, try to load from localStorage (can override environment)
|
||||
// Only try localStorage if we're in a browser context (not in workers)
|
||||
try {
|
||||
|
|
@ -337,7 +346,10 @@ export const setFeatureFlag = <K extends keyof FeatureFlags>(key: K, value: Feat
|
|||
|
||||
export const isKuzuDBEnabled = (): boolean => featureFlags.isKuzuDBEnabled();
|
||||
export const isKuzuDBPersistenceEnabled = (): boolean => featureFlags.getFlag('enableKuzuDBPersistence');
|
||||
<<<<<<< HEAD
|
||||
export const isKuzuDBDirectWritesEnabled = (): boolean => featureFlags.getFlag('enableKuzuDBDirectWrites');
|
||||
=======
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
export const isDebugModeEnabled = (): boolean => featureFlags.isDebugModeEnabled();
|
||||
export const isPerformanceMonitoringEnabled = (): boolean => featureFlags.isPerformanceMonitoringEnabled();
|
||||
export const isWorkerPoolEnabled = (): boolean => featureFlags.getFlag('enableWorkerPool');
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ export interface KuzuGraphOptions {
|
|||
*/
|
||||
export class KuzuKnowledgeGraph implements KnowledgeGraph {
|
||||
private queryEngine: KuzuQueryEngine;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
private options: KuzuGraphOptions;
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
private pendingNodes: GraphNode[] = [];
|
||||
private pendingRelationships: GraphRelationship[] = [];
|
||||
private nodeCache: Map<string, GraphNode> = new Map();
|
||||
|
|
@ -71,7 +75,11 @@ export class KuzuKnowledgeGraph implements KnowledgeGraph {
|
|||
/**
|
||||
* Commit a single node with auto-recovery for missing tables
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public async commitSingleNode(node: GraphNode): Promise<void> {
|
||||
=======
|
||||
private async commitSingleNode(node: GraphNode): Promise<void> {
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
try {
|
||||
const tableName = node.label;
|
||||
|
||||
|
|
@ -121,7 +129,11 @@ export class KuzuKnowledgeGraph implements KnowledgeGraph {
|
|||
/**
|
||||
* Commit a single relationship with auto-recovery for missing tables
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public async commitSingleRelationship(rel: GraphRelationship): Promise<void> {
|
||||
=======
|
||||
private async commitSingleRelationship(rel: GraphRelationship): Promise<void> {
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
try {
|
||||
await this.queryEngine.executeQuery(
|
||||
`MATCH (a {id: '${rel.source}'}), (b {id: '${rel.target}'}) MERGE (a)-[:${rel.type} ${this.formatPropertiesForQuery(rel.properties)}]->(b)`
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@ import { ParallelParsingProcessor } from './parallel-parsing-processor.ts';
|
|||
import { ImportProcessor } from './import-processor.ts';
|
||||
import { CallProcessor } from './call-processor.ts';
|
||||
import { WebWorkerPoolUtils } from '../../lib/web-worker-pool.js';
|
||||
<<<<<<< HEAD
|
||||
import { isKuzuDBEnabled, isKuzuDBDirectWritesEnabled } from '../../config/feature-flags.ts';
|
||||
=======
|
||||
import { isKuzuDBEnabled } from '../../config/feature-flags.ts';
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
|
||||
export interface PipelineInput {
|
||||
projectRoot: string;
|
||||
|
|
@ -134,6 +138,7 @@ export class ParallelGraphPipeline {
|
|||
console.log('🔧 Worker Pool Statistics:', workerStats);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Handle post-processing based on graph type
|
||||
if ('flushPendingOperations' in graph) {
|
||||
// DirectWriteKnowledgeGraph - flush any remaining operations
|
||||
|
|
@ -143,6 +148,10 @@ export class ParallelGraphPipeline {
|
|||
} else if ('flushKuzuDB' in graph) {
|
||||
// DualWriteKnowledgeGraph - traditional batch flush
|
||||
console.log('🔄 Flushing batched KuzuDB operations...');
|
||||
=======
|
||||
// Flush KuzuDB operations and log dual-write statistics if using DualWriteKnowledgeGraph
|
||||
if ('flushKuzuDB' in graph) {
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
await (graph as any).flushKuzuDB();
|
||||
(graph as any).logDualWriteStats();
|
||||
}
|
||||
|
|
@ -262,7 +271,10 @@ export class ParallelGraphPipeline {
|
|||
*/
|
||||
private async createGraph(): Promise<KnowledgeGraph> {
|
||||
console.log(`🔍 KuzuDB enabled check: ${isKuzuDBEnabled()}`);
|
||||
<<<<<<< HEAD
|
||||
console.log(`⚡ KuzuDB direct writes check: ${isKuzuDBDirectWritesEnabled()}`);
|
||||
=======
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
|
||||
if (isKuzuDBEnabled()) {
|
||||
try {
|
||||
|
|
@ -286,6 +298,7 @@ export class ParallelGraphPipeline {
|
|||
autoCommit: false
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Choose between direct-write and dual-write based on feature flag
|
||||
if (isKuzuDBDirectWritesEnabled()) {
|
||||
const { DirectWriteKnowledgeGraph } = await import('../graph/direct-write-knowledge-graph.ts');
|
||||
|
|
@ -301,6 +314,12 @@ export class ParallelGraphPipeline {
|
|||
console.log('✅ KuzuDB integration initialized - using dual-write mode (with flush)');
|
||||
return new DualWriteKnowledgeGraph(kuzuGraph);
|
||||
}
|
||||
=======
|
||||
// Return transparent dual-write graph
|
||||
const { DualWriteKnowledgeGraph } = await import('../graph/dual-write-knowledge-graph.ts');
|
||||
console.log('✅ KuzuDB integration initialized - using dual-write mode');
|
||||
return new DualWriteKnowledgeGraph(kuzuGraph);
|
||||
>>>>>>> f8ce76cfe1df1b6682e8f921e51c532978b30f84
|
||||
|
||||
} catch (error) {
|
||||
console.warn('❌ KuzuDB initialization failed, falling back to JSON-only mode:', error);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue