Documentation ¶
Index ¶
- Constants
- type AttrGauge
- type SlicedCounter
- type ThemisEngine
- func (p *ThemisEngine) BuildQueryData(ctx context.Context, state request.Request) (interface{}, error)
- func (p *ThemisEngine) BuildReplyData(ctx context.Context, state request.Request, queryData interface{}) (interface{}, error)
- func (p *ThemisEngine) BuildRule(args []string) (policy.Rule, error)
- func (p *ThemisEngine) Evaluate(data interface{}) (int, error)
- func (pp *ThemisEngine) SetupMetrics(c *caddy.Controller) error
- type ThemisPlugin
Constants ¶
const ( BucketCnt = 16 FreshCnt = 10 )
const ( AttrGaugeStopped = iota AttrGaugeStarted AttrGaugeStopping )
const ( DefaultEraseInterval = 500 * time.Millisecond DefaultQueryChanSize = 1000 )
const ThemisPluginName = "themis"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttrGauge ¶
type AttrGauge struct {
// contains filtered or unexported fields
}
AttrGauge manages GaugeVec for attributes. GaugeVec holds the counters for recently received (last FreshCnt seconds) DNS queries per attribute/value
func (*AttrGauge) AddAttributes ¶
AddAttribute adds new attribute names to gauge. It's safe to call it from any goroutine. The AttrGauge should be started before calling AddAttributes
func (*AttrGauge) Inc ¶
func (g *AttrGauge) Inc(attr pdp.AttributeAssignment)
Inc increments the counter corresponding to the attr. It's safe to call it from any goroutine. The AttrGauge should be started before calling Inc
type SlicedCounter ¶
type SlicedCounter struct {
// contains filtered or unexported fields
}
SlicedCounter stores the counter value both as a single number and as a separate values per second. The sum of values per second is synchronized with total value but not guaranteed to be equal at any moment of time
func NewSlicedCounter ¶
func NewSlicedCounter(ut uint32) *SlicedCounter
NewSlicedCounter creates new SlicedCounter
func (*SlicedCounter) EraseStale ¶
func (sc *SlicedCounter) EraseStale(ut uint32)
EraseStale erases the values from stale buckets, decrements the total counter by the sum of erased values, and updates the oldestValid time. Should be run in single goroutine
func (*SlicedCounter) Inc ¶
func (sc *SlicedCounter) Inc(ut uint32) bool
Inc increments the latest and total counters. Can be called simultaneously from different goroutines
func (*SlicedCounter) Total ¶
func (sc *SlicedCounter) Total() uint32
Total returns the counter value
type ThemisEngine ¶
type ThemisEngine struct {
// contains filtered or unexported fields
}
func (*ThemisEngine) BuildQueryData ¶
func (*ThemisEngine) BuildReplyData ¶
func (*ThemisEngine) BuildRule ¶
func (p *ThemisEngine) BuildRule(args []string) (policy.Rule, error)
func (*ThemisEngine) Evaluate ¶
func (p *ThemisEngine) Evaluate(data interface{}) (int, error)
func (*ThemisEngine) SetupMetrics ¶
func (pp *ThemisEngine) SetupMetrics(c *caddy.Controller) error
SetupMetrics checks for configured metrics attributes and starts and configures globalAttrGauge as needed
type ThemisPlugin ¶
type ThemisPlugin struct {
// contains filtered or unexported fields
}
func (*ThemisPlugin) Engine ¶
func (p *ThemisPlugin) Engine(name string) policy.Engine
Engine implements the Engineer interface
func (*ThemisPlugin) Name ¶
func (p *ThemisPlugin) Name() string
Name implements the Handler interface