Documentation
¶
Overview ¶
package noop implements a noop QoS module, enabling a gateway operator to support services which do not yet have a QoS implementation.
Index ¶
- type HTTPResponse
- type NoOpQoS
- func (NoOpQoS) ApplyObservations(_ *qosobservations.Observations) error
- func (NoOpQoS) CheckWebsocketConnection() bool
- func (NoOpQoS) GetPerceivedBlockNumber() uint64
- func (NoOpQoS) GetRequiredQualityChecks(_ protocol.EndpointAddr) []gateway.RequestQoSContext
- func (NoOpQoS) HydrateDisqualifiedEndpointsResponse(_ protocol.ServiceID, _ *devtools.DisqualifiedEndpointResponse)
- func (NoOpQoS) ParseHTTPRequest(_ context.Context, httpRequest *http.Request, _ sharedtypes.RPCType) (gateway.RequestQoSContext, bool)
- func (q NoOpQoS) ParseWebsocketRequest(_ context.Context) (gateway.RequestQoSContext, bool)
- func (NoOpQoS) UpdateFromExtractedData(_ protocol.EndpointAddr, _ *qostypes.ExtractedData) error
- type RandomEndpointSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPResponse ¶
type HTTPResponse struct {
// contains filtered or unexported fields
}
HTTPResponse stores the data required for building and returning a user-facing HTTP response based on the response received from an endpoint to a service request.
func (*HTTPResponse) GetHTTPHeaders ¶
func (h *HTTPResponse) GetHTTPHeaders() map[string]string
GetHTTPHeaders always returns nil, as HTTP headers are not used by noop QoS as of PR #106. See: https://github.com/pokt-network/path/pull/106 Implements the pathhttp.HTTPResponse interface.
func (*HTTPResponse) GetHTTPStatusCode ¶
func (h *HTTPResponse) GetHTTPStatusCode() int
GetHTTPStatusCode returns the HTTP status code of the user-facing HTTP response. Implements the pathhttp.HTTPResponse interface.
func (*HTTPResponse) GetPayload ¶
func (h *HTTPResponse) GetPayload() []byte
GetPayload returns the payload of the user-facing HTTP response. Implements the pathhttp.HTTPResponse interface.
type NoOpQoS ¶
type NoOpQoS struct{}
func NewNoOpQoSService ¶ added in v1.0.10
NewNoOpQoSService creates a new NoOp QoS service instance. The logger and serviceID parameters are accepted for interface consistency but are not used by NoOp QoS.
func (NoOpQoS) ApplyObservations ¶
func (NoOpQoS) ApplyObservations(_ *qosobservations.Observations) error
ApplyObservations on noop QoS only fulfills the interface requirements and does not perform any actions. Implements the gateway.QoSService interface.
func (NoOpQoS) CheckWebsocketConnection ¶
CheckWebsocketConnection returns true if the endpoint supports Websocket connections. NoOp QoS does not support Websocket connections.
func (NoOpQoS) GetPerceivedBlockNumber ¶ added in v1.0.12
GetPerceivedBlockNumber always returns 0 for the noop QoS. Implements gateway.QoSService interface.
func (NoOpQoS) GetRequiredQualityChecks ¶
func (NoOpQoS) GetRequiredQualityChecks(_ protocol.EndpointAddr) []gateway.RequestQoSContext
GetRequiredQualityChecks on noop QoS only fulfills the interface requirements and does not perform any actions. Implements the gateway.QoSService interface.
func (NoOpQoS) HydrateDisqualifiedEndpointsResponse ¶
func (NoOpQoS) HydrateDisqualifiedEndpointsResponse(_ protocol.ServiceID, _ *devtools.DisqualifiedEndpointResponse)
HydrateDisqualifiedEndpointsResponse is a no-op for the noop QoS.
func (NoOpQoS) ParseHTTPRequest ¶
func (NoOpQoS) ParseHTTPRequest(_ context.Context, httpRequest *http.Request, _ sharedtypes.RPCType) (gateway.RequestQoSContext, bool)
ParseHTTPRequest reads the supplied HTTP request's body and passes it on to a new requestContext instance. It intentionally avoids performing any validation on the request, as is the designed behavior of the noop QoS. Implements the gateway.QoSService interface. Fallback logic for NoOp: header → jsonrpc (NoOp passes through requests without validation)
func (NoOpQoS) ParseWebsocketRequest ¶
ParseWebsocketRequest builds a request context from the provided Websocket request. This method implements the gateway.QoSService interface.
func (NoOpQoS) UpdateFromExtractedData ¶ added in v1.0.10
func (NoOpQoS) UpdateFromExtractedData(_ protocol.EndpointAddr, _ *qostypes.ExtractedData) error
UpdateFromExtractedData is a no-op for the noop QoS. Implements gateway.QoSService interface.
type RandomEndpointSelector ¶
type RandomEndpointSelector struct{}
RandomEndpointSelector returns a randomly selected endpoint from the set of available ones, when its Select method is called. It has no fields, since the endpoint selection is random, i.e. no data is kept on the endpoints.
func (RandomEndpointSelector) Select ¶
func (RandomEndpointSelector) Select(endpoints protocol.EndpointAddrList) (protocol.EndpointAddr, error)
Select returns a randomly selected endpoint from the set of supplied endpoints. This method fulfills the protocol.EndpointSelector interface.
func (RandomEndpointSelector) SelectMultiple ¶
func (RandomEndpointSelector) SelectMultiple(endpoints protocol.EndpointAddrList, numEndpoints uint) (protocol.EndpointAddrList, error)
SelectMultiple returns multiple randomly selected endpoints from the set of supplied endpoints. This method fulfills the protocol.EndpointSelector interface.