Versions in this module Expand all Collapse all v1 v1.5.4 Oct 26, 2023 Changes in this version + const Created + const Deleted + const Disabled + const Initialized + const Initializing + const RuleNotExists + var DefaultStatisticReportPeriod = 1 * time.Second + var ExpireFactor = 1 * time.Second + func FormatLabelToStr(request *data.CommonRateLimitRequest, rule *apitraffic.Rule) (string, bool) + func HasRegex(rule *apitraffic.Rule) bool + func IsSuccess(code uint32) bool + type AsyncRateLimitConnector interface + Destroy func() + GetMessageSender func(svcKey model.ServiceKey, hashValue uint64) (RateLimitMsgSender, error) + StreamCount func() int + func NewAsyncRateLimitConnector(valueCtx model.ValueContext, cfg config.Configuration) AsyncRateLimitConnector + type CounterIdentifier struct + func (c CounterIdentifier) String() string + type DurationBaseCallBack struct + type FlowQuotaAssistant struct + func (f *FlowQuotaAssistant) AddWindowCount() + func (f *FlowQuotaAssistant) AsyncRateLimitConnector() AsyncRateLimitConnector + func (f *FlowQuotaAssistant) CountRateLimitWindowSet() int + func (f *FlowQuotaAssistant) DelWindowCount() + func (f *FlowQuotaAssistant) DeleteRateLimitWindowSet(svcKey model.ServiceKey) + func (f *FlowQuotaAssistant) Destroy() + func (f *FlowQuotaAssistant) GetAllWindowSets() map[model.ServiceKey]*RateLimitWindowSet + func (f *FlowQuotaAssistant) GetQuota(commonRequest *data.CommonRateLimitRequest) (*model.QuotaFutureImpl, error) + func (f *FlowQuotaAssistant) GetRateLimitWindow(svcKey model.ServiceKey, rule *apitraffic.Rule, label string) (*RateLimitWindowSet, *RateLimitWindow) + func (f *FlowQuotaAssistant) GetRateLimitWindowSet(svcKey model.ServiceKey, create bool) *RateLimitWindowSet + func (f *FlowQuotaAssistant) GetWindowCount() int32 + func (f *FlowQuotaAssistant) Init(engine model.Engine, cfg config.Configuration, supplier plugin.Supplier) error + func (f *FlowQuotaAssistant) IsDestroyed() bool + func (f *FlowQuotaAssistant) OnServiceDeleted(event *common.PluginEvent) error + func (f *FlowQuotaAssistant) OnServiceUpdated(event *common.PluginEvent) error + func (f *FlowQuotaAssistant) TaskValues() model.TaskValues + type HostIdentifier struct + func (h HostIdentifier) String() string + type InitializeRecord struct + func (ir *InitializeRecord) Expired(nowMilli int64) bool + type RateLimitMsgSender interface + AdjustTime func() int64 + HasInitialized func(svcKey model.ServiceKey, labels string) bool + SendInitRequest func(request *ratelimiter.RateLimitInitRequest, callback ResponseCallBack) + SendReportRequest func(request *limitpb.ClientRateLimitReportRequest) error + type RateLimitWindow struct + Labels string + PluginData map[int32]interface{} + Rule *apitraffic.Rule + SvcKey model.ServiceKey + WindowSet *RateLimitWindowSet + func NewRateLimitWindow(windowSet *RateLimitWindowSet, rule *apitraffic.Rule, ...) *RateLimitWindow + func (r *RateLimitWindow) AllocateQuota(commonRequest *data.CommonRateLimitRequest) *model.QuotaResponse + func (r *RateLimitWindow) AsyncRateLimitConnector() AsyncRateLimitConnector + func (r *RateLimitWindow) CasStatus(oldStatus int64, status int64) bool + func (r *RateLimitWindow) CompareTo(another interface{}) int + func (r *RateLimitWindow) DoAsyncRemoteAcquire() error + func (r *RateLimitWindow) DoAsyncRemoteInit() error + func (r *RateLimitWindow) Engine() model.Engine + func (r *RateLimitWindow) EnsureDeleted(value interface{}) bool + func (r *RateLimitWindow) Expired(nowMilli int64) bool + func (r *RateLimitWindow) GetLastAccessTimeMilli() int64 + func (r *RateLimitWindow) GetStatus() int64 + func (r *RateLimitWindow) Init() + func (r *RateLimitWindow) InitializeRequest() *slimiter.RateLimitInitRequest + func (r *RateLimitWindow) OnInitResponse(counter *slimiter.QuotaCounter, duration time.Duration, srvTimeMilli int64) + func (r *RateLimitWindow) OnReportResponse(counter *slimiter.QuotaLeft, duration time.Duration, curTimeMilli int64) + func (r *RateLimitWindow) SetStatus(status int64) + func (r *RateLimitWindow) UpdateTimeDiff(timeDiff int64) + type RateLimitWindowSet struct + func NewRateLimitWindowSet(assistant *FlowQuotaAssistant) *RateLimitWindowSet + func (rs *RateLimitWindowSet) AddRateLimitWindow(commonRequest *data.CommonRateLimitRequest, rule *apitraffic.Rule, ...) *RateLimitWindow + func (rs *RateLimitWindowSet) GetRateLimitWindow(rule *apitraffic.Rule, flatLabels string) *RateLimitWindow + func (rs *RateLimitWindowSet) GetRateLimitWindows() []*RateLimitWindow + func (rs *RateLimitWindowSet) OnServiceUpdated(svcEventObject *common.ServiceEventObject) + func (rs *RateLimitWindowSet) OnWindowExpired(nowMilli int64, window *RateLimitWindow) bool + func (rs *RateLimitWindowSet) PurgeWindows(nowMilli int64) + type RemoteErrorContainer struct + type RemoteQuotaCallBack struct + func NewRemoteQuotaCallback(cfg config.Configuration, supplier plugin.Supplier, engine model.Engine, ...) (*RemoteQuotaCallBack, error) + func (r *RemoteQuotaCallBack) OnTaskEvent(event model.TaskEvent) + func (r *RemoteQuotaCallBack) Process(taskKey interface{}, taskValue interface{}, lastProcessTime time.Time) model.TaskResult + type RemoteSyncParam struct + type ResponseCallBack interface + OnInitResponse func(counter *ratelimiter.QuotaCounter, duration time.Duration, curTimeMilli int64) + OnReportResponse func(counter *ratelimiter.QuotaLeft, duration time.Duration, curTimeMilli int64) + type StreamCounterSet struct + HostIdentifier *HostIdentifier + func NewStreamCounterSet(asyncConnector *asyncRateLimitConnector, identifier *HostIdentifier) *StreamCounterSet + func (s *StreamCounterSet) AdjustTime() int64 + func (s *StreamCounterSet) CompareTo(value interface{}) int + func (s *StreamCounterSet) EnsureDeleted(value interface{}) bool + func (s *StreamCounterSet) Expired(nowMilli int64, clearRecords bool) bool + func (s *StreamCounterSet) HasInitialized(svcKey model.ServiceKey, labels string) bool + func (s *StreamCounterSet) SendInitRequest(initReq *ratelimiter.RateLimitInitRequest, callback ResponseCallBack) + func (s *StreamCounterSet) SendReportRequest(clientReportReq *limitpb.ClientRateLimitReportRequest) error + type WindowContainer struct + MainWindow *RateLimitWindow + WindowByLabel map[string]*RateLimitWindow + func NewWindowContainer() *WindowContainer + func (w *WindowContainer) GetRateLimitWindows() []*RateLimitWindow