Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

feat: wire BulkIngestionService into HTTP routes and Main

riley0227ab452b22920f
diff --git a/memory-layer/src/main/scala/ix/memory/Main.scala b/memory-layer/src/main/scala/ix/memory/Main.scala
index 3f915d2e..29ef36fd 100644
--- a/memory-layer/src/main/scala/ix/memory/Main.scala
+++ b/memory-layer/src/main/scala/ix/memory/Main.scala
@@ -26,12 +26,14 @@ object Main extends IOApp.Simple {
_ <- Resource.eval(client.ensureSchema())
// 2. Core APIs
- writeApi = new ArangoGraphWriteApi(client)
- queryApi = new ArangoGraphQueryApi(client)
+ writeApi = new ArangoGraphWriteApi(client)
+ queryApi = new ArangoGraphQueryApi(client)
+ bulkWriteApi = new BulkWriteApi(client)
// 3. Services
- parserRouter = new ParserRouter()
- ingestionService = new IngestionService(parserRouter, writeApi, queryApi)
+ parserRouter = new ParserRouter()
+ ingestionService = new IngestionService(parserRouter, writeApi, queryApi)
+ bulkIngestionService = new BulkIngestionService(parserRouter, bulkWriteApi, queryApi)
seeder = new GraphSeeder(queryApi)
expander = new GraphExpander(queryApi)
claimCollector = new ClaimCollector(queryApi)
@@ -42,7 +44,7 @@ object Main extends IOApp.Simple {
conflictService = new ConflictService(client, queryApi, writeApi)
// 4. HTTP routes
- routes = Routes.all(contextService, ingestionService, queryApi, writeApi, conflictService, client)
+ routes = Routes.all(contextService, ingestionService, bulkIngestionService, queryApi, writeApi, conflictService, client)
// 5. Server
server <- EmberServerBuilder
diff --git a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala b/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala
index 13abea0a..763bbbfc 100644
--- a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala
+++ b/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala
@@ -9,7 +9,7 @@ import org.http4s.HttpRoutes
import org.http4s.circe.CirceEntityCodec._
import org.http4s.dsl.io._
-import ix.memory.ingestion.IngestionService
+import ix.memory.ingestion.{BulkIngestionService, IngestionService}
case class IngestRequest(path: String, language: Option[String], recursive: Option[Boolean])
@@ -25,7 +25,7 @@ object IngestResponse {
implicit val decoder: Decoder[IngestResponse] = deriveDecoder[IngestResponse]
}
-class IngestionRoutes(ingestionService: IngestionService) {
+class IngestionRoutes(ingestionService: IngestionService, bulkIngestionService: BulkIngestionService) {
val routes: HttpRoutes[IO] = HttpRoutes.of[IO] {
case req @ POST -> Root / "v1" / "ingest" =>
@@ -35,7 +35,7 @@ class IngestionRoutes(ingestionService: IngestionService) {
new IllegalArgumentException("Path traversal not allowed")
)
path = Paths.get(body.path)
- result <- ingestionService.ingestPath(path, body.language, body.recursive.getOrElse(false))
+ result <- bulkIngestionService.ingestPath(path, body.language, body.recursive.getOrElse(false))
resp <- Ok(IngestResponse(
filesProcessed = result.filesProcessed,
patchesApplied = result.patchesApplied,
diff --git a/memory-layer/src/main/scala/ix/memory/api/Routes.scala b/memory-layer/src/main/scala/ix/memory/api/Routes.scala
index 3113d274..e4283e31 100644
--- a/memory-layer/src/main/scala/ix/memory/api/Routes.scala
+++ b/memory-layer/src/main/scala/ix/memory/api/Routes.scala
@@ -11,14 +11,15 @@ import org.http4s.dsl.io._
import ix.memory.conflict.ConflictService
import ix.memory.context.ContextService
import ix.memory.db.{ArangoClient, GraphQueryApi, GraphWriteApi}
-import ix.memory.ingestion.IngestionService
+import ix.memory.ingestion.{BulkIngestionService, IngestionService}
object Routes {
def all(
- contextService: ContextService,
- ingestionService: IngestionService,
- queryApi: GraphQueryApi,
+ contextService: ContextService,
+ ingestionService: IngestionService,
+ bulkIngestionService: BulkIngestionService,
+ queryApi: GraphQueryApi,
writeApi: GraphWriteApi,
conflictService: ConflictService,
client: ArangoClient
@@ -30,7 +31,7 @@ object Routes {
}
val contextRoutes = new ContextRoutes(contextService).routes
- val ingestionRoutes = new IngestionRoutes(ingestionService).routes
+ val ingestionRoutes = new IngestionRoutes(ingestionService, bulkIngestionService).routes
val entityRoutes = new EntityRoutes(queryApi).routes
val diffRoutes = new DiffRoutes(queryApi).routes
val conflictRoutes = new ConflictRoutes(conflictService).routes