api

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureRouter

func ConfigureRouter(debug bool) *gin.Engine

func RegisterHealthChecker added in v0.37.0

func RegisterHealthChecker(hc HealthChecker)

RegisterHealthChecker adds a health checker to be queried during health checks

func ResetHealthCheckers added in v0.37.0

func ResetHealthCheckers()

ResetHealthCheckers clears all registered health checkers. This is intended for use in tests to prevent state leakage between tests.

Types

type API

type API interface {
	Start() error
	AddRoute(method, path string, handler gin.HandlerFunc)
}

type APIOption

type APIOption func(*APIv1)

func WithGroup

func WithGroup(group string) APIOption

func WithHost

func WithHost(host string) APIOption

func WithPort

func WithPort(port uint) APIOption

type APIRouteRegistrar

type APIRouteRegistrar interface {
	RegisterRoutes()
}

type APIv1

type APIv1 struct {
	ApiGroup *gin.RouterGroup
	Host     string
	Port     uint
	// contains filtered or unexported fields
}

func GetInstance

func GetInstance() *APIv1

func New

func New(debug bool, options ...APIOption) *APIv1

func (*APIv1) AddRoute

func (a *APIv1) AddRoute(method, path string, handler gin.HandlerFunc)

func (*APIv1) Engine

func (a *APIv1) Engine() *gin.Engine

func (*APIv1) Start

func (a *APIv1) Start() error

@license.name Apache 2.0 @license.url http://www.apache.org/licenses/LICENSE-2.0.html

type EventHub added in v0.38.0

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

EventHub manages event broadcasting to connected WebSocket/SSE clients. Call Close() to shut down the hub and release resources.

func NewEventHub added in v0.38.0

func NewEventHub(ringSize uint) *EventHub

NewEventHub creates a hub with the given ring buffer size.

func (*EventHub) Broadcast added in v0.38.0

func (h *EventHub) Broadcast(evt event.Event)

Broadcast sends an event to all connected clients. Called from the pipeline observer goroutine. Non-blocking per client.

The lock is held for the entire client iteration because the cleanup path closes client.send under the same lock. Releasing the lock before sending would allow a concurrent close, causing a send-to-closed-channel panic. The sends are non-blocking (select with default) so lock duration is bounded.

func (*EventHub) Close added in v0.38.0

func (h *EventHub) Close()

Close shuts down the hub, terminating the InputChan goroutine and allowing client handlers to exit cleanly. Blocks until background goroutines have exited.

func (*EventHub) HandleEvents added in v0.38.0

func (h *EventHub) HandleEvents(c *gin.Context)

HandleEvents is the Gin handler for GET /events. It upgrades to WebSocket if possible, otherwise falls back to SSE.

func (*EventHub) InputChan added in v0.38.0

func (h *EventHub) InputChan() chan<- event.Event

InputChan returns a channel that feeds the hub. The hub reads events from this channel and broadcasts them. Used as the pipeline observer target. The goroutine exits when Close() is called or the channel is closed.

type HealthChecker added in v0.37.0

type HealthChecker interface {
	IsRunning() bool
}

HealthChecker is an interface for components that can report their health status

Jump to

Keyboard shortcuts

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