Documentation ¶
Index ¶
- Variables
- type BaseModelMeter
- type ByNameAndWindow
- type InMemoryMeter
- func (i *InMemoryMeter) Add(id string, name string, data map[string]string, tw kodex.TimeWindow, ...) error
- func (i *InMemoryMeter) AddToModel(model kodex.Model, name string, tw kodex.TimeWindow, value int64) error
- func (i *InMemoryMeter) Get(id string, name string, data map[string]string, tw kodex.TimeWindow) (*kodex.Metric, error)
- func (i *InMemoryMeter) ModelID(model kodex.Model) string
- func (i *InMemoryMeter) N(id string, to int64, n int64, name, twType string) ([]*kodex.Metric, error)
- func (i *InMemoryMeter) Range(id string, from, to int64, name, twType string) ([]*kodex.Metric, error)
- type RedisMeter
- func (r *RedisMeter) Add(id string, name string, data map[string]string, tw kodex.TimeWindow, ...) error
- func (r *RedisMeter) Get(id string, name string, data map[string]string, tw kodex.TimeWindow) (*kodex.Metric, error)
- func (r *RedisMeter) GetByTimeIds(id string, from, to int64, tId, maxTId int64, name, twType string) ([]*kodex.Metric, error)
- func (r *RedisMeter) N(id string, to, n int64, name, twType string) ([]*kodex.Metric, error)
- func (r *RedisMeter) Range(id string, from, to int64, name, twType string) ([]*kodex.Metric, error)
- func (r *RedisMeter) Teardown() error
Constants ¶
This section is empty.
Variables ¶
View Source
var InMemoryMeterForm = forms.Form{ ErrorMsg: "invalid data encountered in the Redis config form", Fields: []forms.Field{}, }
View Source
var RedisMeterForm = forms.Form{ ErrorMsg: "invalid data encountered in the Redis config form", Fields: []forms.Field{ { Name: "addresses", Validators: []forms.Validator{ forms.IsRequired{}, forms.IsStringList{}, }, }, { Name: "database", Validators: []forms.Validator{ forms.IsOptional{Default: 0}, forms.IsInteger{Min: 0, Max: 100}, }, }, { Name: "password", Validators: []forms.Validator{ forms.IsRequired{}, forms.IsString{}, }, }, }, }
Functions ¶
This section is empty.
Types ¶
type BaseModelMeter ¶
func (*BaseModelMeter) AddToModel ¶
func (r *BaseModelMeter) AddToModel(model kodex.Model, name string, tw kodex.TimeWindow, value int64) error
type ByNameAndWindow ¶
func (ByNameAndWindow) Len ¶
func (b ByNameAndWindow) Len() int
func (ByNameAndWindow) Less ¶
func (b ByNameAndWindow) Less(i, j int) bool
func (ByNameAndWindow) Swap ¶
func (b ByNameAndWindow) Swap(i, j int)
type InMemoryMeter ¶
type InMemoryMeter struct {
BaseModelMeter
}
func MakeInMemoryMeter ¶
func MakeInMemoryMeter(config map[string]interface{}) (*InMemoryMeter, error)
func (*InMemoryMeter) Add ¶
func (i *InMemoryMeter) Add(id string, name string, data map[string]string, tw kodex.TimeWindow, value int64) error
Add the given value to the metric
func (*InMemoryMeter) AddToModel ¶
func (i *InMemoryMeter) AddToModel(model kodex.Model, name string, tw kodex.TimeWindow, value int64) error
func (*InMemoryMeter) Get ¶
func (i *InMemoryMeter) Get(id string, name string, data map[string]string, tw kodex.TimeWindow) (*kodex.Metric, error)
Return the metric and its assigned quota
type RedisMeter ¶
type RedisMeter struct { BaseModelMeter // contains filtered or unexported fields }
func MakeRedisMeter ¶
func MakeRedisMeter(config map[string]interface{}) (*RedisMeter, error)
func (*RedisMeter) Add ¶
func (r *RedisMeter) Add(id string, name string, data map[string]string, tw kodex.TimeWindow, value int64) error
func (*RedisMeter) Get ¶
func (r *RedisMeter) Get(id string, name string, data map[string]string, tw kodex.TimeWindow) (*kodex.Metric, error)
func (*RedisMeter) GetByTimeIds ¶
func (*RedisMeter) Teardown ¶
func (r *RedisMeter) Teardown() error
Click to show internal directories.
Click to hide internal directories.