df58bc25a3
---ci--- project: orca phase: 3 milestone: v0.3 status: complete requirements: covered: [REQ-022, REQ-030, REQ-032] partial: [] ---/ci--- v0.3 milestone merged to main. Includes all v0.2 work (P08-P10) that was previously on the milestone branch but not yet merged to main, plus the v0.3 completion work (iter.Seq streaming + doctor network/db). v0.2 phases included: P08 (mTLS), P09 (scheduling), P10 (security scan). v0.3 phases: P0 (pre-execution), P1 (iter.Seq streaming), P2 (doctor), P3 (final review+ship). Total: 40 requirements, all complete. No new go.mod dependencies. Full test suite passes under -race. gofmt + go vet clean.
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
// Package daemon — dispatch_handler.go mounts the orca.v1.Dispatch
|
|
// service on the daemon's HTTP server. The service is registered as
|
|
// two handlers (POST /orca.v1.Dispatch/Submit and /Status) and is
|
|
// gated on the mTLS state — if the server is in plaintext mode
|
|
// (v0.1 compat), the handlers refuse to serve.
|
|
package daemon
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.cloudinit.dev/coreci/orca/internal/transport"
|
|
)
|
|
|
|
// DispatchHandlers groups the Submit and Status handlers so they
|
|
// can be registered as a unit on the daemon mux.
|
|
type DispatchHandlers struct {
|
|
Submit *transport.SubmitHandler
|
|
Status *transport.StatusHandler
|
|
}
|
|
|
|
// NewDispatchHandlers builds the dispatch handler pair from a
|
|
// transport.Dispatcher (the engine layer satisfies this).
|
|
func NewDispatchHandlers(d transport.Dispatcher, dedupe *transport.IdempotencyStore) *DispatchHandlers {
|
|
if dedupe == nil {
|
|
dedupe = transport.NewIdempotencyStore()
|
|
}
|
|
return &DispatchHandlers{
|
|
Submit: transport.NewSubmitHandler(d, dedupe),
|
|
Status: transport.NewStatusHandler(d),
|
|
}
|
|
}
|
|
|
|
// Mount registers Submit and Status on the given mux. Called by the
|
|
// daemon's mux builder.
|
|
func (h *DispatchHandlers) Mount(mux *http.ServeMux) {
|
|
mux.Handle("/orca.v1.Dispatch/Submit", h.Submit)
|
|
mux.Handle("/orca.v1.Dispatch/Status", h.Status)
|
|
}
|