Documentation
¶
Overview ¶
Package node assembles a running jetwayd from a configuration.
It exists so that there is exactly one wiring. jetwayd builds a node and serves it; the scenario suite builds a node and drives it. An integration test standing on a second, parallel copy of this assembly would be testing the copy -- and this repository has twice shipped tests that passed because they encoded the same assumption as the code they were checking.
Index ¶
- type Node
- func (n *Node) Addr(listener string) string
- func (n *Node) Close()
- func (n *Node) Drain(ctx context.Context, hs *http.Server)
- func (n *Node) Handler() ingress.Handler
- func (n *Node) Listeners() []ingress.Ingress
- func (n *Node) LivePeers() []string
- func (n *Node) Serve(ctx context.Context, drainTimeout time.Duration) error
- func (n *Node) Start(ctx context.Context) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
Config *config.Config
Log *slog.Logger
Store store.Store
Gateway *gateway.Gateway
Bus *gateway.Bus
Queues *queue.Manager
Sweeper *queue.Sweeper
Router *egress.Router
Spool *spool.Spool
Fleet *demo.RunningFleet
API *api.Server
// contains filtered or unexported fields
}
Node is an assembled gateway: store, links, queues, sweeper and console.
Everything a caller might want to drive or assert on is exported, because the scenario suite is a legitimate consumer rather than a special case that needs back doors cut for it.
func Build ¶
Build assembles a node without starting anything that accepts work.
Listeners bind here, so a port conflict or an unreadable certificate fails at build time rather than later in a goroutine where it reads as silence.
func (*Node) Addr ¶
Addr returns the address of the named TCP listener, which is how a test that asked for port 0 finds out what it got.
func (*Node) Close ¶
func (n *Node) Close()
Close releases everything Build acquired. It is safe on a partly built node, which is what makes it usable on Build's own error paths.
func (*Node) Drain ¶
Drain stops taking new work, lets what is in flight finish, then stops serving. Cutting links first would lose messages mid-pipeline.
func (*Node) Handler ¶
makeHandler builds the function every ingress calls. Handler is the ingress callback: it is what turns bytes off a link into a stored, parsed, applied message.
type Options ¶
type Options struct {
// LocatorSecret seeds record locator allocation. Required.
LocatorSecret []byte
// SkipConsole omits the HTTP server. A load run wants the pipeline, not
// the console.
SkipConsole bool
// ExtendAPI is passed through to the console's mux, so an embedder can
// serve its own pages from the node's one listener.
ExtendAPI func(mux *http.ServeMux)
}
Options are the knobs the scenario suite needs and jetwayd does not.