Documentation
¶
Index ¶
- type App
- type Handler
- func (h *Handler) ConfigureMiddleware(router *fiber.App)
- func (h *Handler) Reduce(ctx context.Context, input *ReduceRequest) (*ReduceResponse, error)
- func (h *Handler) RegisterRoutes(api huma.API)
- func (h *Handler) Remove(ctx context.Context, input *RemoveRequest) (*RemoveResponse, error)
- func (h *Handler) Stats(ctx context.Context, input *StatsRequest) (*StatsResponse, error)
- type ReduceRequest
- type ReduceResponse
- type ReduceResponseBody
- type RemoveRequest
- type RemoveResponse
- type StatsRequest
- type StatsResponse
- type StatsResponseBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
RateLimiter *limiter.RateLimiter
PathMap map[string]string
// contains filtered or unexported fields
}
type Handler ¶
type Handler struct {
RateLimiter *limiter.RateLimiter
PathMap map[string]string
}
func (*Handler) ConfigureMiddleware ¶
func (*Handler) Reduce ¶
func (h *Handler) Reduce(ctx context.Context, input *ReduceRequest) (*ReduceResponse, error)
func (*Handler) RegisterRoutes ¶
func (*Handler) Remove ¶
func (h *Handler) Remove(ctx context.Context, input *RemoveRequest) (*RemoveResponse, error)
func (*Handler) Stats ¶
func (h *Handler) Stats(ctx context.Context, input *StatsRequest) (*StatsResponse, error)
type ReduceRequest ¶
type ReduceRequest struct {
Key string `path:"key" maxLength:"1024" example:"user:1" doc:"Key for the lock"`
MaxTokens int64 `path:"max_tokens" minimum:"1" example:"1000" doc:"Maximum number of tokens in the bucket"`
RefillTime int64 `path:"refill_time" minimum:"1" example:"60" doc:"Time in seconds to refill the bucket"`
RefillAmount int64 `path:"refill_amount" minimum:"1" example:"100" doc:"Number of tokens to refill the bucket"`
Tokens int64 `path:"tokens" minimum:"1" example:"1" doc:"Number of tokens to reduce"`
}
type ReduceResponse ¶
type ReduceResponse struct {
Status int
Body ReduceResponseBody
}
type ReduceResponseBody ¶
type RemoveRequest ¶
type RemoveRequest struct {
Key string `path:"key" maxLength:"1024" example:"user:1" doc:"Key for the lock"`
MaxTokens int64 `path:"max_tokens" minimum:"1" example:"1000" doc:"Maximum number of tokens in the bucket"`
RefillTime int64 `path:"refill_time" minimum:"1" example:"60" doc:"Time in seconds to refill the bucket"`
RefillAmount int64 `path:"refill_amount" minimum:"1" example:"100" doc:"Number of tokens to refill the bucket"`
}
type RemoveResponse ¶
type StatsRequest ¶
type StatsRequest struct {
}
type StatsResponse ¶
type StatsResponse struct {
Status int
Body StatsResponseBody
}
type StatsResponseBody ¶
type StatsResponseBody struct {
NumGoroutines int `json:"num_goroutines" example:"1" doc:"Number of goroutines"`
CPU int64 `json:"cpu" example:"53373" doc:"CPU usage in nanoseconds"`
MaxRSS float64 `json:"max_rss" example:"15777792" doc:"Max RSS in bytes"`
NumberOfKeys int64 `json:"number_of_keys" example:"543" doc:"Number of keys in the rate limiter"`
}
Click to show internal directories.
Click to hide internal directories.