Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHttpAdapter ¶
func RegisterHttpAdapter[M any, O any](mux *http.ServeMux, adapter HttpAdapter[M, O], params RegisterHttpAdapterParams)
Register a HttpAdapter to a http.ServeMux
Types ¶
type HealthEncoder ¶
type HealthEncoder = func(ServerHealth) ([]byte, int)
function mapping health metrics of a server to a byte blob ready for streaming over http. The second return is the http status code
type HttpAdapter ¶
func (*HttpAdapter[M, O]) HandleCall ¶
func (h *HttpAdapter[M, O]) HandleCall() http.HandlerFunc
Returns the http handler function for synchronous calls to the server
func (*HttpAdapter[M, O]) HandleSend ¶
func (h *HttpAdapter[M, O]) HandleSend() http.HandlerFunc
Returns the http handler function for asynchronous sends to the server
func (*HttpAdapter[M, O]) HealthHandler ¶
func (h *HttpAdapter[M, O]) HealthHandler(enc HealthEncoder) http.HandlerFunc
returns the http handler for fetching the health metrics of the server.
type HttpMarshaller ¶
type RegisterHttpAdapterParams ¶
type RegisterHttpAdapterParams struct {
HealthEnc HealthEncoder // function that encoedes the server health to the desired output format
SendMiddleware Chain // middleware chain for the .../send endpoint
CallMiddleware Chain // middleware chain for the .../call endpoint
HealthMiddleware Chain // middleware chain for the .../health endpoint
// contains filtered or unexported fields
}
Params for HttpAdapter to http.ServeMux registration
type ServerHealth ¶
type ServerHealth struct {
Stats crossbow.StatsSnapshot
MailboxLen int
Terminated bool
}
Health metrics of a server aggregated into a single struct for encoding
Click to show internal directories.
Click to hide internal directories.