Documentation
¶
Overview ¶
Package primary provides inbound (driving) adapters for the API server: the HTTP server with its controllers and the scheduler executor that runs background runners.
Index ¶
- Constants
- Variables
- func AsController(f any) any
- func New() fx.Option
- func NewEngine(controllers []Controller, securityService *security.Service, ...) *gin.Engine
- func NewHTTP() fx.Option
- func NewHTTPServer(lifecycle fx.Lifecycle, engine *gin.Engine, settings *config.ServerSettings, ...) *http.Server
- type Controller
- type Executor
Constants ¶
View Source
const ( // DefaultHTTPReadTimeout is the default timeout for reading HTTP requests. // It should be set to a reasonable value to avoid security issues. DefaultHTTPReadTimeout = 30 * time.Second // DefaultHTTPIdleTimeout is how long a keep-alive connection stays open // between requests. It must be longer than the OpAMP HTTP client's poll // interval (default 30s) — otherwise the server can close an idle // keep-alive connection exactly as the client tries to reuse it, which // surfaces as `Post ... : EOF` on the agent. When unset, net/http falls // back to ReadTimeout, which produces that exact race. DefaultHTTPIdleTimeout = 120 * time.Second )
Variables ¶
View Source
var ErrServerIDRequired = errors.New("server ID is required for kafka messaging consumer group")
ErrServerIDRequired is returned when Kafka messaging is configured without a server ID.
Functions ¶
func AsController ¶
AsController annotates a controller constructor so its result is provided as the Controller interface into the "controllers" group consumed by NewEngine.
func NewEngine ¶
func NewEngine( controllers []Controller, securityService *security.Service, rbacUsecase userport.RBACUsecase, userUsecase userport.UserUsecase, settings *config.ServerSettings, observabilityService *observability.Service, logger *slog.Logger, ) *gin.Engine
NewEngine creates a new Gin engine and registers the provided controllers' routes.
Types ¶
type Controller ¶
type Controller interface {
RoutesInfo() gin.RoutesInfo
}
Controller is an interface that defines the methods for handling HTTP requests.
Click to show internal directories.
Click to hide internal directories.