Documentation
¶
Index ¶
- Constants
- func NewRatelimitServiceHandler(svc RatelimitServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type RatelimitServiceClient
- type RatelimitServiceHandler
- type UnimplementedRatelimitServiceHandler
- func (UnimplementedRatelimitServiceHandler) CommitLease(context.Context, *connect.Request[v1.CommitLeaseRequest]) (*connect.Response[v1.CommitLeaseResponse], error)
- func (UnimplementedRatelimitServiceHandler) Liveness(context.Context, *connect.Request[v1.LivenessRequest]) (*connect.Response[v1.LivenessResponse], error)
- func (UnimplementedRatelimitServiceHandler) Mitigate(context.Context, *connect.Request[v1.MitigateRequest]) (*connect.Response[v1.MitigateResponse], error)
- func (UnimplementedRatelimitServiceHandler) MultiRatelimit(context.Context, *connect.Request[v1.RatelimitMultiRequest]) (*connect.Response[v1.RatelimitMultiResponse], error)
- func (UnimplementedRatelimitServiceHandler) PushPull(context.Context, *connect.Request[v1.PushPullRequest]) (*connect.Response[v1.PushPullResponse], error)
- func (UnimplementedRatelimitServiceHandler) Ratelimit(context.Context, *connect.Request[v1.RatelimitRequest]) (*connect.Response[v1.RatelimitResponse], error)
Constants ¶
const ( // RatelimitServiceLivenessProcedure is the fully-qualified name of the RatelimitService's Liveness // RPC. RatelimitServiceLivenessProcedure = "/ratelimit.v1.RatelimitService/Liveness" // RatelimitServiceRatelimitProcedure is the fully-qualified name of the RatelimitService's // Ratelimit RPC. RatelimitServiceRatelimitProcedure = "/ratelimit.v1.RatelimitService/Ratelimit" // RatelimitServiceMultiRatelimitProcedure is the fully-qualified name of the RatelimitService's // MultiRatelimit RPC. RatelimitServiceMultiRatelimitProcedure = "/ratelimit.v1.RatelimitService/MultiRatelimit" // RatelimitServicePushPullProcedure is the fully-qualified name of the RatelimitService's PushPull // RPC. RatelimitServicePushPullProcedure = "/ratelimit.v1.RatelimitService/PushPull" // RatelimitServiceCommitLeaseProcedure is the fully-qualified name of the RatelimitService's // CommitLease RPC. RatelimitServiceCommitLeaseProcedure = "/ratelimit.v1.RatelimitService/CommitLease" // RatelimitServiceMitigateProcedure is the fully-qualified name of the RatelimitService's Mitigate // RPC. RatelimitServiceMitigateProcedure = "/ratelimit.v1.RatelimitService/Mitigate" )
These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.
const (
// RatelimitServiceName is the fully-qualified name of the RatelimitService service.
RatelimitServiceName = "ratelimit.v1.RatelimitService"
)
Variables ¶
This section is empty.
Functions ¶
func NewRatelimitServiceHandler ¶
func NewRatelimitServiceHandler(svc RatelimitServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewRatelimitServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.
By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.
Types ¶
type RatelimitServiceClient ¶
type RatelimitServiceClient interface { Liveness(context.Context, *connect.Request[v1.LivenessRequest]) (*connect.Response[v1.LivenessResponse], error) Ratelimit(context.Context, *connect.Request[v1.RatelimitRequest]) (*connect.Response[v1.RatelimitResponse], error) MultiRatelimit(context.Context, *connect.Request[v1.RatelimitMultiRequest]) (*connect.Response[v1.RatelimitMultiResponse], error) // Internal // // PushPull syncs the ratelimit with the origin server // For each identifier there is an origin server, agred upon by every node in the ring via // consistent hashing // // PushPull notifies the origin of a ratelimit operation that happened and then pulls the latest // ratelimit information from the origin server to update its own local state PushPull(context.Context, *connect.Request[v1.PushPullRequest]) (*connect.Response[v1.PushPullResponse], error) CommitLease(context.Context, *connect.Request[v1.CommitLeaseRequest]) (*connect.Response[v1.CommitLeaseResponse], error) Mitigate(context.Context, *connect.Request[v1.MitigateRequest]) (*connect.Response[v1.MitigateResponse], error) }
RatelimitServiceClient is a client for the ratelimit.v1.RatelimitService service.
func NewRatelimitServiceClient ¶
func NewRatelimitServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RatelimitServiceClient
NewRatelimitServiceClient constructs a client for the ratelimit.v1.RatelimitService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).
type RatelimitServiceHandler ¶
type RatelimitServiceHandler interface { Liveness(context.Context, *connect.Request[v1.LivenessRequest]) (*connect.Response[v1.LivenessResponse], error) Ratelimit(context.Context, *connect.Request[v1.RatelimitRequest]) (*connect.Response[v1.RatelimitResponse], error) MultiRatelimit(context.Context, *connect.Request[v1.RatelimitMultiRequest]) (*connect.Response[v1.RatelimitMultiResponse], error) // Internal // // PushPull syncs the ratelimit with the origin server // For each identifier there is an origin server, agred upon by every node in the ring via // consistent hashing // // PushPull notifies the origin of a ratelimit operation that happened and then pulls the latest // ratelimit information from the origin server to update its own local state PushPull(context.Context, *connect.Request[v1.PushPullRequest]) (*connect.Response[v1.PushPullResponse], error) CommitLease(context.Context, *connect.Request[v1.CommitLeaseRequest]) (*connect.Response[v1.CommitLeaseResponse], error) Mitigate(context.Context, *connect.Request[v1.MitigateRequest]) (*connect.Response[v1.MitigateResponse], error) }
RatelimitServiceHandler is an implementation of the ratelimit.v1.RatelimitService service.
type UnimplementedRatelimitServiceHandler ¶
type UnimplementedRatelimitServiceHandler struct{}
UnimplementedRatelimitServiceHandler returns CodeUnimplemented from all methods.
func (UnimplementedRatelimitServiceHandler) CommitLease ¶
func (UnimplementedRatelimitServiceHandler) CommitLease(context.Context, *connect.Request[v1.CommitLeaseRequest]) (*connect.Response[v1.CommitLeaseResponse], error)
func (UnimplementedRatelimitServiceHandler) Liveness ¶
func (UnimplementedRatelimitServiceHandler) Liveness(context.Context, *connect.Request[v1.LivenessRequest]) (*connect.Response[v1.LivenessResponse], error)
func (UnimplementedRatelimitServiceHandler) Mitigate ¶
func (UnimplementedRatelimitServiceHandler) Mitigate(context.Context, *connect.Request[v1.MitigateRequest]) (*connect.Response[v1.MitigateResponse], error)
func (UnimplementedRatelimitServiceHandler) MultiRatelimit ¶
func (UnimplementedRatelimitServiceHandler) MultiRatelimit(context.Context, *connect.Request[v1.RatelimitMultiRequest]) (*connect.Response[v1.RatelimitMultiResponse], error)
func (UnimplementedRatelimitServiceHandler) PushPull ¶
func (UnimplementedRatelimitServiceHandler) PushPull(context.Context, *connect.Request[v1.PushPullRequest]) (*connect.Response[v1.PushPullResponse], error)
func (UnimplementedRatelimitServiceHandler) Ratelimit ¶
func (UnimplementedRatelimitServiceHandler) Ratelimit(context.Context, *connect.Request[v1.RatelimitRequest]) (*connect.Response[v1.RatelimitResponse], error)