router

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(
	logger polylog.Logger,
	gateway gatewayHandler,
	disqualifiedEndpointsReporter disqualifiedEndpointsReporter,
	healthChecker *health.Checker,
	config config.RouterConfig,
	circuitBreakerAdmin CircuitBreakerAdmin,
) *router

NewRouter creates a new router instance

Types

type CircuitBreakerAdmin added in v1.0.15

type CircuitBreakerAdmin interface {
	ClearService(ctx context.Context, serviceID string) int
}

CircuitBreakerAdmin allows clearing circuit breaker state via admin endpoints.

type ConfigReporter added in v1.0.10

type ConfigReporter interface {
	// GetSanitizedConfig returns a sanitized view of the active configuration.
	// All sensitive information (private keys, passwords) MUST be redacted.
	GetSanitizedConfig() map[string]interface{}
}

ConfigReporter provides sanitized configuration information. Implemented by components that can report their active configuration.

type ServiceReadinessReporter added in v1.0.10

type ServiceReadinessReporter interface {
	// GetServiceReadiness returns readiness info for a specific service.
	// Returns endpoint count, whether sessions are available, and any error.
	GetServiceReadiness(serviceID protocol.ServiceID) (endpointCount int, hasSession bool, err error)

	// GetServiceEndpointDetails returns detailed endpoint information for a specific service.
	// Includes reputation scores, archival status, latency metrics, and more.
	GetServiceEndpointDetails(serviceID protocol.ServiceID) ([]protocol.EndpointDetails, error)

	// GetServicePerceivedBlockHeight returns the perceived block height for a service.
	// This is the highest block number observed across all endpoints for the service.
	// Returns 0 if no block number has been observed yet.
	GetServicePerceivedBlockHeight(serviceID protocol.ServiceID) uint64

	// GetServiceBlockConsensusStats returns block consensus statistics for a service.
	// Returns (medianBlock, observationCount) for observability.
	GetServiceBlockConsensusStats(serviceID protocol.ServiceID) (medianBlock uint64, observationCount int)

	// ConfiguredServiceIDs returns all configured service IDs.
	ConfiguredServiceIDs() map[protocol.ServiceID]struct{}
}

ServiceReadinessReporter provides readiness information for services. Implemented by the protocol to report session and endpoint availability.

type ServiceReadinessResponse added in v1.0.10

type ServiceReadinessResponse struct {
	Ready    bool                        `json:"ready"`
	Services map[string]ServiceReadyInfo `json:"services,omitempty"`
	Message  string                      `json:"message,omitempty"`
}

ServiceReadinessResponse is the JSON response for /ready endpoints.

type ServiceReadyInfo added in v1.0.10

type ServiceReadyInfo struct {
	Ready                bool                       `json:"ready"`
	EndpointCount        int                        `json:"endpoint_count"`
	HasSession           bool                       `json:"has_session"`
	PerceivedBlockHeight uint64                     `json:"perceived_block_height,omitempty"`
	MedianBlockHeight    uint64                     `json:"median_block_height,omitempty"`
	BlockObservations    int                        `json:"block_observations,omitempty"`
	Error                string                     `json:"error,omitempty"`
	Endpoints            []protocol.EndpointDetails `json:"endpoints,omitempty"`
}

ServiceReadyInfo contains readiness info for a single service.

Jump to

Keyboard shortcuts

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