Documentation
¶
Overview ¶
Package api exposes the gateway over HTTP: a booking endpoint, read access to the message log and the PNR store, and a live event stream that the console uses to show traffic as it happens.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Explained ¶
type Explained struct {
Format string `json:"format"`
Summary string `json:"summary"`
Envelope []Field `json:"envelope"`
Parts []Part `json:"parts"`
Diagnostics []store.Diagnostic `json:"diagnostics,omitempty"`
Raw string `json:"raw"`
}
Explained is a message rendered for a human: the envelope, the body broken into parts, and whatever the decoders complained about.
type Field ¶
type Field struct {
Name string `json:"name"`
Value string `json:"value"`
Note string `json:"note,omitempty"`
}
Field is one labelled value in a decoded view.
type Part ¶
type Part struct {
Kind string `json:"kind"`
Wire string `json:"wire"`
Fields []Field `json:"fields,omitempty"`
// Note explains what the segment or element carries.
Note string `json:"note,omitempty"`
// Unrecognised marks content no grammar claimed, which is the signal that a
// partner's dialect has drifted from the profile in use.
Unrecognised bool `json:"unrecognised,omitempty"`
}
Part is one decoded element or segment.
type Server ¶
type Server struct {
Gateway *gateway.Gateway
Store store.Store
Bus *gateway.Bus
Log *slog.Logger
// Links reports which peers are currently connected.
Links *transport.Server
// Fleet is the simulated carrier fleet, when one is running. Nil in a
// deployment with real partners.
Fleet *demo.RunningFleet
// Console serves the operations console. It is unauthenticated, so a
// deployment reachable beyond a trusted network should turn it off.
Console bool
// Metrics serves /metrics.
Metrics bool
// Ready reports whether dependencies are usable. A nil Ready means always
// ready, which is only right for the demo.
Ready func(ctx context.Context) error
// LinkPeers lists peers with a live link, for /api/status.
LinkPeers func() []string
// Extend, when set, is called with the mux before the built-in routes are
// registered, letting an embedder add pages and endpoints to the same
// listener. Paths under /api/ and the root are taken; pick a prefix.
Extend func(mux *http.ServeMux)
// Ground is this node's departure control, when it runs one. Nil hides
// the departures endpoints and the console's Departures view.
Ground *dcs.Station
// OnAccept, OnOffload and OnClose let the embedder transmit what an
// agent's action produced: the bag messages at acceptance, the bag pull
// at offload, the whole message set at close. The API itself only
// changes the flight; the gateway owns the wire.
OnAccept func(ctx context.Context, acc *dcs.Acceptance)
OnOffload func(ctx context.Context, f *dcs.Flight, p *dcs.Passenger)
OnClose func(ctx context.Context, cl *dcs.Closure) error
// contains filtered or unexported fields
}
Server serves the API and the console.
Click to show internal directories.
Click to hide internal directories.