Documentation
¶
Overview ¶
Package server exposes the FPGA gzip pipeline as a small HTTP service.
The service is intentionally a separate process boundary from FUSE or an application using the SDK. A request supplies Content-Length because the FPGA shell must know the complete input size before H2C starts. The response body is a standard gzip stream and is written as the FPGA produces it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBusy means the bounded request queue is full. ErrBusy = errors.New("fpga-gzip service queue is full") // ErrContentLength means the client used chunked/unknown-length input. // The FPGA shell cannot start a transaction without an exact input length. ErrContentLength = errors.New("Content-Length is required") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
HardwareFactory func(context.Context) (pipeline.Hardware, error)
Options pipeline.Options
// MaxConcurrent is normally one for a single XDMA H2C/C2H pair. It may be
// raised when HardwareFactory selects independent FPGA streams.
MaxConcurrent int
// QueueDepth bounds requests waiting for a worker. A full queue returns
// HTTP 503 instead of buffering request bodies in the daemon.
QueueDepth int
// MaxInputBytes limits request bodies. Zero disables the limit.
MaxInputBytes int64
}
Config controls one service instance. HardwareFactory is called once for each admitted request and must return a fresh hardware handle. A Device's streaming descriptors are closed when a transaction ends, so sharing one handle across requests is not supported.
type Option ¶
Option customizes a Server without changing the transport or pipeline configuration. Options are applied at construction time.
func WithAlgorithms ¶ added in v0.0.3
WithAlgorithms enables request algorithms for a multi-image daemon. An image still contains one algorithm. A mismatch returns HTTP 409 before reset/DMA. Without this option the service accepts only gzip.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an HTTP handler and listener lifecycle for the compression daemon.
func New ¶
New validates config and creates a service. A zero Options value selects the SDK defaults; non-zero options are passed to pipeline.RunReader unchanged.
func (*Server) Handler ¶
Handler returns the service's net/http handler. It can be mounted below a reverse proxy or used with httptest without opening a socket.
func (*Server) ListenAndServeTCP ¶
ListenAndServeTCP listens on addr and serves HTTP until ctx is canceled.
func (*Server) ListenAndServeUnix ¶
ListenAndServeUnix listens on a Unix-domain socket. A stale socket left by a crashed daemon is removed; an active listener is never replaced.