webserver-custom

command
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

webserver-custom - a hand-written edge (model B) next to the built-in ingress (model A)

Shows the two edge models side by side in one manifest, both fronting the same counter thrall:

  • api (model A): the built-in [[edge.http]] ingress (AE-035) - a route→operation mapping, no code.
  • secure-gw (model B): a custom edge thrall written via thrall.StartEdge (main.go). It is an ordinary [[thrall]] with a cmd, supervised like any other. It does a per-request Authorization check - something configuration cannot express - and only then calls the counter.

That is the split: use model A when a route maps cleanly to an operation; reach for model B when you need custom logic (auth, transformation, a non-HTTP protocol, a SCADA driver) around the call. The edge owns the socket and is concurrent/stateless; the state lives in the counter behind it.

StartEdge gives the custom edge the full thrall machinery for free (heartbeat, restart, drain, fencing) - you write only the run-loop (ListenAndServe) and a graceful-stop hook (Shutdown).

Run

export GOTOOLCHAIN=local
mise exec go@latest -- go build -o bin/aether ./cmd/aether
mise exec go@latest -- go build -o bin/counter-go ./examples/counter
mise exec go@latest -- go build -o bin/edge-custom ./examples/webserver-custom

cd examples/webserver-custom
../../bin/aether up -f aether.toml

Try it

curl -s localhost:7392/value                                   # model A: no auth -> the value
curl -s localhost:7393/value                                   # model B: no auth header -> 401
curl -s -H 'Authorization: Bearer secret' localhost:7393/value # model B: authorized -> the value

Polyglot

The custom edge exists in all three SDKs - main.go, edge.ts and edge.py - each an equivalent run-loop over its language's HTTP server, all supervised identically. aether.toml runs the Go edge (with the model A ingress alongside), aether-ts.toml the TypeScript one, aether-py.toml the Python one - a Python edge fronting the Go counter, so the wire contract is proven language-neutral:

cd examples/webserver-custom
uv venv && uv pip install --python .venv/bin/python -r requirements.txt
../../bin/aether up -f aether-py.toml   # then the same model B curls on :7393

Boundary: head-of-line blocking

Both edges are concurrent, but the counter behind them is a single serialized mailbox - its throughput is the ceiling. A slow operation on the hot path blocks other requests waiting on that one thrall. Keep the stateful backend fast, or split the load across more thralls; the edge concurrency does not remove that limit.

Documentation

Overview

Custom edge (model B): a webserver written by hand via thrall.StartEdge. Unlike the built-in [[edge.http]] ingress (model A), it does something configuration cannot express - here a per-request Authorization check - before calling the stateful counter thrall over the ether. State lives in the counter; the edge only owns the socket.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL