// queryd is the SQL execution layer — DuckDB via cgo, registers // catalog datasets as views, executes ad-hoc SQL. D5 wires the // actual /sql route + DuckDB session with S3 secret plumbed in // (per Opus B2 fix). D1 just stands up the binary. // // NOTE: cgo handle lifecycle. The shared server factory's // graceful-shutdown is enough for G0 (DuckDB connections are // goroutine-local), but G1+ when persistent prepared statements + // HNSW indexes attach, queryd will need its own OnShutdown drain // hook. Tracked in D7.5 (W3 disposition). package main import ( "flag" "log/slog" "os" "git.agentview.dev/profit/golangLAKEHOUSE/internal/shared" "github.com/go-chi/chi/v5" ) func main() { configPath := flag.String("config", "lakehouse.toml", "path to TOML config") flag.Parse() cfg, err := shared.LoadConfig(*configPath) if err != nil { slog.Error("config", "err", err) os.Exit(1) } if err := shared.Run("queryd", cfg.Queryd.Bind, func(_ chi.Router) { // D5 wires: // POST /sql (JSON body {"sql": "..."} → DuckDB exec → JSON rows) // Internal: TTL-cached views + etag invalidation against catalogd. }); err != nil { slog.Error("server", "err", err) os.Exit(1) } }