feat(landscape): HTTP API, worker consumer, wiring, docs
Adds the /landscape routes (slots, slot upload, runs, run detail, results), mounts them in the router, wires the landscape repository, job publisher, godal raster IO and Compute into the composition root, and registers the gis-landscape-runner consumer in the worker. Also fixes the Dockerfile so the image actually runs: godal's cgo needs g++, and the runtime base must match the builder's Alpine release or libgdal's soname does not resolve. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"gis/api"
|
||||
"gis/internal/config"
|
||||
"gis/internal/domain"
|
||||
"gis/internal/landscape"
|
||||
"gis/internal/messaging/rabbitmq"
|
||||
"gis/internal/parser"
|
||||
"gis/internal/platform/logger"
|
||||
@@ -39,6 +40,7 @@ type App struct {
|
||||
categories *service.CategoryService
|
||||
datasets *service.DatasetService
|
||||
groups *service.DatasetGroupService
|
||||
landscape *service.LandscapeService
|
||||
eventRepo *postgres.EventRepository
|
||||
}
|
||||
|
||||
@@ -72,8 +74,13 @@ func New(ctx context.Context) (*App, error) {
|
||||
groupRepo := postgres.NewDatasetGroupRepository(pool)
|
||||
eventRepo := postgres.NewEventRepository(pool)
|
||||
|
||||
lpRepo := postgres.NewLandscapeRepository(pool)
|
||||
|
||||
publisher := rabbitmq.NewPublisher(rabbit)
|
||||
jobPublisher := rabbitmq.NewDatasetJobPublisher(publisher)
|
||||
lpJobs := rabbitmq.NewLandscapeJobPublisher(publisher)
|
||||
|
||||
datasetsSvc := service.NewDatasetService(datasetRepo, store, categoryRepo, groupRepo, jobPublisher, parser.Columns, parser.Rows, raster.NewGDALConverter())
|
||||
|
||||
return &App{
|
||||
Cfg: cfg,
|
||||
@@ -83,9 +90,13 @@ func New(ctx context.Context) (*App, error) {
|
||||
rabbit: rabbit,
|
||||
publisher: publisher,
|
||||
categories: service.NewCategoryService(categoryRepo),
|
||||
datasets: service.NewDatasetService(datasetRepo, store, categoryRepo, groupRepo, jobPublisher, parser.Columns, parser.Rows, raster.NewGDALConverter()),
|
||||
datasets: datasetsSvc,
|
||||
groups: service.NewDatasetGroupService(groupRepo, datasetRepo, store),
|
||||
eventRepo: eventRepo,
|
||||
landscape: service.NewLandscapeService(
|
||||
lpRepo, datasetRepo, groupRepo, categoryRepo, datasetsSvc, store,
|
||||
lpJobs, raster.NewGodalIO(), landscape.Compute, log,
|
||||
),
|
||||
eventRepo: eventRepo,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -108,6 +119,7 @@ func (a *App) Handler() stdhttp.Handler {
|
||||
Categories: transporthttp.NewCategoryHandler(a.categories, validate),
|
||||
Datasets: transporthttp.NewDatasetHandler(a.datasets, validate),
|
||||
DatasetGroups: transporthttp.NewDatasetGroupHandler(a.groups, validate),
|
||||
Landscape: transporthttp.NewLandscapeHandler(a.landscape, validate),
|
||||
OpenAPISpec: api.Spec,
|
||||
})
|
||||
}
|
||||
@@ -124,10 +136,20 @@ func (a *App) Consumers() []*rabbitmq.Consumer {
|
||||
a.PropertiesConsumer(),
|
||||
a.ExtractConsumer(),
|
||||
a.ConvertConsumer(),
|
||||
a.LandscapeConsumer(),
|
||||
a.ExampleConsumer(),
|
||||
}
|
||||
}
|
||||
|
||||
// LandscapeConsumer builds the Landscape Program run consumer.
|
||||
func (a *App) LandscapeConsumer() *rabbitmq.Consumer {
|
||||
handler := rabbitmq.NewLandscapeRunHandler(a.landscape, a.Log)
|
||||
return rabbitmq.NewConsumer(
|
||||
a.rabbit, rabbitmq.LandscapeRunQueue, rabbitmq.LandscapeRunRoutingKey,
|
||||
"gis-landscape-runner", handler, a.Log,
|
||||
)
|
||||
}
|
||||
|
||||
// PropertiesConsumer builds the plain-vector properties-extraction consumer.
|
||||
func (a *App) PropertiesConsumer() *rabbitmq.Consumer {
|
||||
handler := rabbitmq.NewPropertiesHandler(a.datasets, a.Log)
|
||||
|
||||
Reference in New Issue
Block a user