gateway

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 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.

Documentation

Overview

Package gateway is the host's public endpoint of a restored engine: a TCP listener that forwards the inference routes, and only those, to the agent's inference socket. Until the restore has passed its checks every request gets 503, so a client never waits on a half-restored engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, l net.Listener, g *Gateway, grace time.Duration) error

Serve runs the gateway on l until ctx ends, then drains for up to grace.

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway forwards inference requests once ready.

func New

func New(socket string, onToken func()) *Gateway

New forwards to the engine behind socket; onToken runs once, when the first completion bytes go out.

func (*Gateway) Drain

func (g *Gateway) Drain(ctx context.Context) error

Drain closes admission and waits for the admitted requests, streaming bodies included.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP admits the inference routes, answers /health from readiness and refuses the management routes (sleep, wake, collective RPC).

func (*Gateway) SetReady

func (g *Gateway) SetReady(ready bool)

SetReady opens or closes admission.

Jump to

Keyboard shortcuts

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