Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureRouter ¶
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 APIRouteRegistrar ¶
type APIRouteRegistrar interface {
RegisterRoutes()
}
type APIv1 ¶
func GetInstance ¶
func GetInstance() *APIv1
func New ¶
New initializes the singleton API instance. The debug parameter is retained for backward compatibility; access-log verbosity is now governed by the configured logging level (LOGGING_LEVEL), not by this flag.
func (*APIv1) AddRoute ¶
func (a *APIv1) AddRoute(method, path string, handler http.HandlerFunc)
AddRoute registers handler for method+path under the configured group base path. Note: net/http's ServeMux panics if the same method+pattern is registered twice, so callers must register each route only once (the push plugin guards this with a routesRegistered flag). A path that already ends in "/" is registered as a ServeMux subtree (prefix match) with no exact-match variant, matching all sub-paths; avoid trailing slashes unless that is intended.
func (*APIv1) BasePath ¶ added in v0.43.0
BasePath returns the configured route group prefix (e.g. "/v1"), or "".
func (*APIv1) Engine ¶
Engine returns the middleware-wrapped HTTP handler. Routes added via AddRoute after this call remain reachable because the handler wraps the underlying mux by reference.
func (*APIv1) HandleFunc ¶ added in v0.43.0
func (a *APIv1) HandleFunc(pattern string, handler http.HandlerFunc)
HandleFunc registers a handler on the underlying mux without the group prefix. The pattern must include the method, e.g. "GET /events".
func (*APIv1) Start ¶
@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
NewEventHub creates a hub with the given ring buffer size.
func (*EventHub) Broadcast ¶ added in v0.38.0
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(w http.ResponseWriter, r *http.Request)
HandleEvents is the net/http handler for GET /events. It upgrades to WebSocket if possible, otherwise falls back to SSE.
@Summary Stream Blockchain Events
@Description Real-time pipeline event streaming. Automatically upgrades to WebSocket if requested by the client, otherwise falls back to Server-Sent Events (SSE). Supports filtering on event types.
@Param types query string false "Comma-separated list of event types to filter (e.g., input.block,input.transaction)"
@Param replay query boolean false "Whether to replay recent events from the ring buffer on connection" default(true)
@Produce text/event-stream,application/json
@Success 200 {string} string "Event Stream (SSE) or WebSocket Session"
@Router /events [get]
type HealthChecker ¶ added in v0.37.0
type HealthChecker interface {
IsRunning() bool
}
HealthChecker is an interface for components that can report their health status