resources

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsRouter

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

MetricsRouter multiplexes Prometheus metrics by the first path segment (chainID), and then requires the next segment to be 'metrics'. Effective paths:

/{chain}/metrics

The wrapped handler is expected to serve on '/'.

func NewMetricsRouter

func NewMetricsRouter(log gethlog.Logger) *MetricsRouter

func (*MetricsRouter) Close

func (r *MetricsRouter) Close() error

func (*MetricsRouter) ServeHTTP

func (r *MetricsRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*MetricsRouter) SetHandler

func (r *MetricsRouter) SetHandler(chainID string, h http.Handler)

type MetricsService

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

MetricsService encapsulates an HTTP server that serves the MetricsRouter.

func NewMetricsService

func NewMetricsService(log gethlog.Logger, listenAddr string, port int, handler http.Handler) *MetricsService

NewMetricsService constructs a metrics HTTP server bound to the given address/port using the provided handler.

func (*MetricsService) Start

func (s *MetricsService) Start(onError func(error))

Start begins serving metrics in a background goroutine. If the server exits with an error, the optional onError callback is invoked.

func (*MetricsService) Stop

func (s *MetricsService) Stop(ctx context.Context) error

Stop gracefully shuts down the metrics server.

type NonCloseableL1BeaconClient

type NonCloseableL1BeaconClient struct {
	*sources.L1BeaconClient
}

NonCloseableL1BeaconClient wraps an L1BeaconClient to prevent it from being closed. This is used when sharing a single beacon client across multiple virtual nodes.

func NewNonCloseableL1BeaconClient

func NewNonCloseableL1BeaconClient(client *sources.L1BeaconClient) *NonCloseableL1BeaconClient

NewNonCloseableL1BeaconClient wraps an L1BeaconClient to prevent closure. Returns nil if the input client is nil (beacon client is optional).

func (*NonCloseableL1BeaconClient) Close

func (c *NonCloseableL1BeaconClient) Close()

type NonCloseableL1Client

type NonCloseableL1Client struct {
	*sources.L1Client
}

NonCloseableL1Client wraps an L1Client to prevent it from being closed. This is used when sharing a single L1Client across multiple virtual nodes, where we don't want any individual node to close the shared resource.

func NewNonCloseableL1Client

func NewNonCloseableL1Client(client *sources.L1Client) *NonCloseableL1Client

NewNonCloseableL1Client wraps an L1Client to prevent closure.

func (*NonCloseableL1Client) Close

func (c *NonCloseableL1Client) Close()

Close is a no-op for the non-closeable wrapper. The underlying client should only be closed when the supernode itself shuts down.

type NonCloseableRPC

type NonCloseableRPC struct {
	client.RPC
}

NonCloseableRPC wraps an RPC client to prevent it from being closed. This is used when sharing a single RPC connection across multiple clients.

func NewNonCloseableRPC

func NewNonCloseableRPC(rpcClient client.RPC) *NonCloseableRPC

NewNonCloseableRPC wraps an RPC client to prevent closure.

func (*NonCloseableRPC) BatchCallContext

func (c *NonCloseableRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error

BatchCallContext delegates to the underlying RPC client

func (*NonCloseableRPC) CallContext

func (c *NonCloseableRPC) CallContext(ctx context.Context, result any, method string, args ...any) error

CallContext delegates to the underlying RPC client

func (*NonCloseableRPC) Close

func (c *NonCloseableRPC) Close()

Close is a no-op for the non-closeable wrapper.

func (*NonCloseableRPC) Subscribe

func (c *NonCloseableRPC) Subscribe(ctx context.Context, namespace string, channel any, args ...any) (ethereum.Subscription, error)

Subscribe delegates to the underlying RPC client

type Router

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

Router multiplexes JSON-RPC requests by the first path segment which represents the chainID.

func NewRouter

func NewRouter(log gethlog.Logger, cfg RouterConfig) *Router

NewRouter constructs an empty Router. Handlers can be added later via SetHandler.

func (*Router) Close

func (r *Router) Close() error

Close releases any resources created by the factory.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP routes requests to the chain-specific handler, after stripping the chain prefix.

func (*Router) SetHandler

func (r *Router) SetHandler(chainID string, h http.Handler)

SetHandler replaces or adds the handler for a given chainID at runtime.

type RouterConfig

type RouterConfig struct {
	EnableWebsockets bool
	MaxBodyBytes     int64
}

RouterConfig defines runtime options for the RPC router server.

Jump to

Keyboard shortcuts

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