Documentation
¶
Overview ¶
Package dataplane assembles the proxy's request path: one inbound gateway that routes by namespace, and one proxy per upstream that translates namespaces, attaches outbound credentials, and optionally encrypts payloads before forwarding to a Temporal Service.
Index ¶
- Variables
- type Dataplane
- type Option
- func WithAbort(fn func(error)) Option
- func WithAllowlist(a services.Allowlist) Option
- func WithAuth(a auth.Authenticator) Option
- func WithExtractor(e *protoutil.Extractor) Option
- func WithLogger(log logger.Logger) Option
- func WithMetrics(f *metrics.Factory) Option
- func WithPool(p *connect.Pool) Option
- func WithProtoTypes(t protoutil.Types) Option
- func WithTranslator(t *protoutil.Translator) Option
- func WithVault(v *crypto.Vault) Option
- type Params
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Options( fx.Provide(newFromParams), fx.Invoke(func(lc fx.Lifecycle, d *Dataplane) { lc.Append(fx.Hook{OnStart: d.Start, OnStop: d.Stop}) }), )
Module provides a Dataplane from the assembled application and binds Start and Stop to the fx lifecycle. It replaces the router, proxy, and server modules: this is the only place in the graph that owns the gateway/proxy topology.
Functions ¶
This section is empty.
Types ¶
type Dataplane ¶
type Dataplane struct {
// contains filtered or unexported fields
}
Dataplane is the assembled request path. It is single-use: not restartable after Stop.
func New ¶
New validates cfg in full, compiles the routing table, derives each upstream's socket path once, and builds both tiers. ctx is long lived and drives each tier's health check; the context passed to Start bounds startup only. Neither stops serving, which only Stop does. New binds nothing and dials nothing. Every Prometheus collector is registered here, so New must be called once per registry.
func (*Dataplane) SocketPath ¶
SocketPath is the unix path the named upstream's proxy binds and the gateway dials. It is the single derivation of that path.
func (*Dataplane) Start ¶
Start binds and serves every upstream socket, opens every static upstream connection so an unreachable one fails startup, then binds and serves the gateway, in that order. It returns once the gateway is accepting. ctx bounds startup only and should carry a deadline, since it is what limits the wait for an upstream to answer; the serving goroutines get the Context passed to New instead. A failure part-way through stops whatever already started.
func (*Dataplane) Stop ¶
Stop drains the gateway first, so no request is admitted for a tier that is going away, then every upstream proxy. Each tier's drain is bounded, so the upstreams go concurrently: they are independent, and serially their budgets would sum, which is how a shutdown overruns the lifecycle deadline and strands the hooks queued behind this one.
type Option ¶
type Option func(*options)
Option configures a Dataplane via New.
func WithAbort ¶
WithAbort sets a function called at most once, from the goroutine that was serving, when a tier stops for a reason other than Stop. It must not block and must not call back into the Dataplane.
func WithAllowlist ¶
WithAllowlist sets the allowlist that decides which services may be forwarded. Required.
func WithAuth ¶
func WithAuth(a auth.Authenticator) Option
WithAuth sets the authenticator applied to inbound gateway requests. Required.
func WithExtractor ¶
WithExtractor sets the extractor the gateway reads routing fields with. Required.
func WithLogger ¶
WithLogger sets the logger used by the dataplane and both tiers, defaulting to logger.Default. A nil logger keeps the default, so an absent optional dependency can be passed straight through.
func WithMetrics ¶
WithMetrics sets the factory every collector is registered with. Required.
func WithPool ¶
WithPool sets the connection pool the dataplane creates upstream connections from. The pool's lifecycle stays with the caller. Required.
func WithProtoTypes ¶
WithProtoTypes sets the type registry messages are resolved against, defaulting to protoregistry.GlobalTypes. A nil registry keeps the default, so an absent optional dependency can be passed straight through.
func WithTranslator ¶
func WithTranslator(t *protoutil.Translator) Option
WithTranslator sets the translator each upstream rewrites namespaces with. Required.
type Params ¶
type Params struct {
fx.In
Shutdowner fx.Shutdowner
Context context.Context
Config *config.Config
Extractor *protoutil.Extractor
Translator *protoutil.Translator
Pool *connect.Pool
Metrics *metrics.Factory
Allowlist services.Allowlist
Auth auth.Authenticator
Vault *crypto.Vault
Types protoutil.Types `optional:"true"`
Logger logger.Logger `optional:"true"`
}
Params collects the fx-provided dependencies New needs. Types and Logger are optional: New falls back to the global proto registry and the default logger when neither is supplied.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dataplanetest runs a dataplane for a test, either constructed directly or assembled from the production fx modules, together with the fake upstreams and connections needed to drive it.
|
Package dataplanetest runs a dataplane for a test, either constructed directly or assembled from the production fx modules, together with the fake upstreams and connections needed to drive it. |