Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActorFrom ¶
ActorFrom returns the authenticated actor from the request context. Panics if called without auth middleware (programming error, not a runtime condition).
func HashAPIKey ¶
HashAPIKey is the exported version for use by bootstrap/tests.
Types ¶
type Route ¶
type Route struct {
Name string
Path string
Summary string
MinRole model.Role
Input any // nil for resources
Output any
Params []model.QueryParam // derived from Filter/Sort structs for resources
Method string // "GET", "POST", etc.
Status int // 200, 201, 204
Handler handler
}
Route is the HTTP-layer representation of a domain resource or operation.
func (Route) PathParams ¶
PathParams returns the path parameters inferred from the Path pattern.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP API server for TaskFlow.
func NewServer ¶
func NewServer(svc taskflow.TaskFlow, cfg ...ServerConfig) *Server
NewServer creates a new HTTP server backed by the given TaskFlow service.
func (*Server) ListenAndServe ¶
ListenAndServe starts the server on the given address with configured timeouts.
type ServerConfig ¶
type ServerConfig struct {
// IdempotencyCacheBytes is the maximum memory budget for the idempotency
// key cache in bytes. Defaults to 50 MB if zero.
IdempotencyCacheBytes int
// EventBus enables SSE event streaming. If nil, the SSE endpoint returns 503.
EventBus *eventbus.EventBus
// MaxRequestBodyBytes limits the size of request bodies.
// Defaults to 1 MB if zero.
MaxRequestBodyBytes int64
// ReadTimeout is the maximum duration for reading the entire request.
// Defaults to 30 seconds if zero.
ReadTimeout time.Duration
// WriteTimeout is the maximum duration for writing the response.
// Defaults to 60 seconds if zero (longer to support SSE).
WriteTimeout time.Duration
// IdleTimeout is the maximum duration an idle keep-alive connection
// remains open. Defaults to 120 seconds if zero.
IdleTimeout time.Duration
// RateLimitPerSecond is the maximum requests per second per API key.
// Defaults to 50 if zero. Set to -1 to disable.
RateLimitPerSecond int
// DevMode disables all rate limiting (per-key and global IP-based).
// Opt-in only via TASKFLOW_DEV_MODE=true.
DevMode bool
}
ServerConfig holds configuration for the HTTP server.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.