Documentation
¶
Index ¶
- func GetRequestErrorForJSONRPCBackendServiceUnmarshalError() *qosobservations.RequestError
- func GetRequestErrorForProtocolError() *qosobservations.RequestError
- type HTTPResponse
- type Observations
- type RequestErrorContext
- func (rec *RequestErrorContext) GetEndpointSelector() protocol.EndpointSelector
- func (rec *RequestErrorContext) GetHTTPResponse() pathhttp.HTTPResponse
- func (rec *RequestErrorContext) GetObservations() qosobservations.Observations
- func (rec *RequestErrorContext) GetServicePayloads() []protocol.Payload
- func (rec *RequestErrorContext) UpdateWithResponse(endpointAddr protocol.EndpointAddr, endpointSerializedResponse []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestErrorForJSONRPCBackendServiceUnmarshalError ¶
func GetRequestErrorForJSONRPCBackendServiceUnmarshalError() *qosobservations.RequestError
GetRequestErrorForJSONRPCBackendServiceUnmarshalError returns a request error for a JSONRPC backend service unmarshaling error. i.e. the payload returned by the endpoint/backend service failed to parse as a valid JSONRPC response.
func GetRequestErrorForProtocolError ¶
func GetRequestErrorForProtocolError() *qosobservations.RequestError
GetRequestErrorForProtocolError returns a request error for a protocol error E.g. the selected endpoint did not return a response.
Types ¶
type HTTPResponse ¶
type HTTPResponse struct {
// contains filtered or unexported fields
}
HTTPResponse encapsulates an HTTP response to be returned to the client including payload data and status code.
func BuildHTTPResponseFromBytes ¶
func BuildHTTPResponseFromBytes( responsePayload []byte, httpStatusCode int, ) HTTPResponse
func BuildHTTPResponseFromJSONRPCResponse ¶
func BuildHTTPResponseFromJSONRPCResponse( logger polylog.Logger, jsonrpcResp jsonrpc.Response, ) HTTPResponse
func (HTTPResponse) GetHTTPHeaders ¶
func (r HTTPResponse) GetHTTPHeaders() map[string]string
GetHTTPHeaders returns the set of headers for the HTTP response. As of PR #72, the only header returned for JSONRPC is `Content-Type`.
func (HTTPResponse) GetHTTPStatusCode ¶
func (hr HTTPResponse) GetHTTPStatusCode() int
GetHTTPStatusCode returns the HTTP status code for this response. If no status code was explicitly set, returns http.StatusOK (200). StatusOK is returned by default from QoS because it is the responsibility of the QoS service to decide on the HTTP status code returned to the client.
func (HTTPResponse) GetPayload ¶
func (hr HTTPResponse) GetPayload() []byte
GetPayload returns the response payload as a byte slice.
type Observations ¶
type Observations struct{}
Observations is a stub type for QoS observations. It may be extended with actual fields and logic as needed.
type RequestErrorContext ¶
type RequestErrorContext struct {
Logger polylog.Logger
// The response to be returned to the user.
Response jsonrpc.Response
// The observations to use for the error.
Observations *qosobservations.Observations
}
RequestErrorContext terminates the processing of a JSONRPC-service request on errors (internal failures or invalid requests). Provides:
- Detailed error response to the user.
- Log entries to warn on potential incorrect usage.
Implements gateway.RequestQoSContext
func RequestContextFromInternalError ¶
func RequestContextFromInternalError(logger polylog.Logger, jsonrpcRequestID jsonrpc.ID, err error) *RequestErrorContext
RequestContextFromInternalError returns a request context for an internal error. E.g. the selected endpoint did not return a response.
func (*RequestErrorContext) GetEndpointSelector ¶
func (rec *RequestErrorContext) GetEndpointSelector() protocol.EndpointSelector
UpdateWithResponse should never be called. It logs a warning and returns a failing selector that logs a warning on all selection attempts. Implements the gateway.RequestQoSContext interface.
func (*RequestErrorContext) GetHTTPResponse ¶
func (rec *RequestErrorContext) GetHTTPResponse() pathhttp.HTTPResponse
GetHTTPResponse formats the stored JSONRPC error as an HTTP response Implements the gateway.RequestQoSContext interface.
func (*RequestErrorContext) GetObservations ¶
func (rec *RequestErrorContext) GetObservations() qosobservations.Observations
TODO_MVP(@adshmh): Generate observations for the error context. GetObservation returns the QoS observation set for the error context. Implements the gateway.RequestQoSContext interface.
func (*RequestErrorContext) GetServicePayloads ¶
func (rec *RequestErrorContext) GetServicePayloads() []protocol.Payload
GetServicePayload should never be called. It logs a warning and returns nil. Implements the gateway.RequestQoSContext interface.
func (*RequestErrorContext) UpdateWithResponse ¶
func (rec *RequestErrorContext) UpdateWithResponse(endpointAddr protocol.EndpointAddr, endpointSerializedResponse []byte)
UpdateWithResponse should never be called. Only logs a warning. Implements the gateway.RequestQoSContext interface.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
package noop implements a noop QoS module, enabling a gateway operator to support services which do not yet have a QoS implementation.
|
package noop implements a noop QoS module, enabling a gateway operator to support services which do not yet have a QoS implementation. |
|
solana package provides the support required for interacting with the Solana blockchain through the gateway.
|
solana package provides the support required for interacting with the Solana blockchain through the gateway. |