registry

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalRegistry = NewHandlerRegistry()

GlobalRegistry is the global handler registry instance

Functions

func RegisterHandler

func RegisterHandler(payloadType string, handler HandlerFunc) error

RegisterHandler is a convenience function to register handlers globally

Types

type HandlerFunc

type HandlerFunc func(c backends.Context, recoveredID string, payloadType string, jsonString string)

HandlerFunc defines the signature for request handlers

type HandlerFuncWithRawRequest

type HandlerFuncWithRawRequest func(c backends.Context, recoveredID string, payloadType string, jsonString string, rawRequest string)

HandlerFuncWithRawRequest defines the signature for request handlers that need access to the raw request

type HandlerRegistrar

type HandlerRegistrar interface {
	RegisterHandlers(registry *HandlerRegistry) error
}

HandlerRegistrar defines the interface for handlers that can register themselves

type HandlerRegistry

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

HandlerRegistry manages the registration of all RPC handlers

func NewHandlerRegistry

func NewHandlerRegistry() *HandlerRegistry

NewHandlerRegistry creates a new handler registry

func (*HandlerRegistry) GetHandler

func (r *HandlerRegistry) GetHandler(payloadType string) (HandlerFunc, bool)

GetHandler retrieves a handler for a specific payload type

func (*HandlerRegistry) GetRegisteredTypes

func (r *HandlerRegistry) GetRegisteredTypes() []string

GetRegisteredTypes returns all registered payload types

func (*HandlerRegistry) HandleRequest

func (r *HandlerRegistry) HandleRequest(c backends.Context, recoveredID string, payloadType string, jsonString string) bool

HandleRequest handles an RPC request by looking up the appropriate handler

func (*HandlerRegistry) HandleRequestWithRaw

func (r *HandlerRegistry) HandleRequestWithRaw(c backends.Context, recoveredID string, payloadType string, jsonString string, rawRequest string) bool

HandleRequestWithRaw handles an RPC request that may need access to raw request data

func (*HandlerRegistry) Register

func (r *HandlerRegistry) Register(payloadType string, handler HandlerFunc) error

Register registers a handler function for a specific payload type

func (*HandlerRegistry) RegisterWithRawRequest

func (r *HandlerRegistry) RegisterWithRawRequest(payloadType string, handler HandlerFuncWithRawRequest) error

RegisterWithRawRequest registers a handler function that needs access to the raw request

Jump to

Keyboard shortcuts

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