counters

package
v0.0.0-...-553e66b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAgentMapEnum

func SetAgentMapEnum(ame map[string]int)

func SetOSMapEnum

func SetOSMapEnum(osme map[string]int)

func SetReverseAgentMapEnum

func SetReverseAgentMapEnum(rame map[int]string)

func SetReverseOSMapEnum

func SetReverseOSMapEnum(rosme map[int]string)

func SetReverseRouteMapEnum

func SetReverseRouteMapEnum(rrme map[int]string)

func SetRouteMapEnum

func SetRouteMapEnum(rme map[string]int)

Types

type DefaultAgentViewCounter

type DefaultAgentViewCounter struct {
	// contains filtered or unexported fields
}
var AgentViewCounter *DefaultAgentViewCounter

func NewDefaultAgentViewCounter

func NewDefaultAgentViewCounter(acc *qgen.Accumulator) (*DefaultAgentViewCounter, error)

func (*DefaultAgentViewCounter) Bump

func (co *DefaultAgentViewCounter) Bump(agent int)

func (*DefaultAgentViewCounter) Tick

func (co *DefaultAgentViewCounter) Tick() error

type DefaultForumViewCounter

type DefaultForumViewCounter struct {
	// contains filtered or unexported fields
}

TODO: Unload forum counters without any views over the past 15 minutes, if the admin has configured the forumstore with a cap and it's been hit? Forums can be reloaded from the database at any time, so we want to keep the counters separate from them

var ForumViewCounter *DefaultForumViewCounter

func NewDefaultForumViewCounter

func NewDefaultForumViewCounter() (*DefaultForumViewCounter, error)

func (*DefaultForumViewCounter) Bump

func (co *DefaultForumViewCounter) Bump(fid int)

func (*DefaultForumViewCounter) Tick

func (co *DefaultForumViewCounter) Tick() error

type DefaultLangViewCounter

type DefaultLangViewCounter struct {
	// contains filtered or unexported fields
}
var LangViewCounter *DefaultLangViewCounter

func NewDefaultLangViewCounter

func NewDefaultLangViewCounter(acc *qgen.Accumulator) (*DefaultLangViewCounter, error)

func (*DefaultLangViewCounter) Bump

func (co *DefaultLangViewCounter) Bump(langCode string) (validCode bool)

func (*DefaultLangViewCounter) Bump2

func (co *DefaultLangViewCounter) Bump2(id int)

func (*DefaultLangViewCounter) Tick

func (co *DefaultLangViewCounter) Tick() error

type DefaultMemoryCounter

type DefaultMemoryCounter struct {
	sync.Mutex
	// contains filtered or unexported fields
}
var MemoryCounter *DefaultMemoryCounter

func NewMemoryCounter

func NewMemoryCounter(acc *qgen.Accumulator) (*DefaultMemoryCounter, error)

func (*DefaultMemoryCounter) Tick

func (co *DefaultMemoryCounter) Tick() (e error)

type DefaultOSViewCounter

type DefaultOSViewCounter struct {
	// contains filtered or unexported fields
}
var OSViewCounter *DefaultOSViewCounter

func NewDefaultOSViewCounter

func NewDefaultOSViewCounter(acc *qgen.Accumulator) (*DefaultOSViewCounter, error)

func (*DefaultOSViewCounter) Bump

func (co *DefaultOSViewCounter) Bump(id int)

func (*DefaultOSViewCounter) Tick

func (co *DefaultOSViewCounter) Tick() error

type DefaultPerfCounter

type DefaultPerfCounter struct {
	// contains filtered or unexported fields
}

TODO: Track perf on a per route basis

var PerfCounter *DefaultPerfCounter

func NewDefaultPerfCounter

func NewDefaultPerfCounter(acc *qgen.Accumulator) (*DefaultPerfCounter, error)

func (*DefaultPerfCounter) Push

func (co *DefaultPerfCounter) Push(dur time.Duration)

func (*DefaultPerfCounter) Tick

func (co *DefaultPerfCounter) Tick() error

type DefaultPostCounter

type DefaultPostCounter struct {
	// contains filtered or unexported fields
}
var PostCounter *DefaultPostCounter

func NewPostCounter

func NewPostCounter() (*DefaultPostCounter, error)

func (*DefaultPostCounter) Bump

func (co *DefaultPostCounter) Bump()

func (*DefaultPostCounter) Tick

func (co *DefaultPostCounter) Tick() (err error)

type DefaultReferrerTracker

type DefaultReferrerTracker struct {
	// contains filtered or unexported fields
}

? We'll track referrer domains here rather than the exact URL they arrived from for now, we'll think about expanding later ? Referrers are fluid and ever-changing so we have to use string keys rather than 'enum' ints

var ReferrerTracker *DefaultReferrerTracker

func NewDefaultReferrerTracker

func NewDefaultReferrerTracker() (*DefaultReferrerTracker, error)

func (*DefaultReferrerTracker) Bump

func (ref *DefaultReferrerTracker) Bump(referrer string)

func (*DefaultReferrerTracker) Tick

func (ref *DefaultReferrerTracker) Tick() (err error)

TODO: Move this and the other view tickers out of the main task loop to avoid blocking other tasks?

type DefaultRouteViewCounter

type DefaultRouteViewCounter struct {
	// contains filtered or unexported fields
}

TODO: Make this lockless?

var RouteViewCounter *DefaultRouteViewCounter

func NewDefaultRouteViewCounter

func NewDefaultRouteViewCounter(acc *qgen.Accumulator) (*DefaultRouteViewCounter, error)

func (*DefaultRouteViewCounter) Bump

func (co *DefaultRouteViewCounter) Bump(route int)

func (*DefaultRouteViewCounter) Bump2

func (co *DefaultRouteViewCounter) Bump2(route int, t time.Time)

TODO: Eliminate the lock?

func (*DefaultRouteViewCounter) Bump3

func (co *DefaultRouteViewCounter) Bump3(route int, nano int64)

TODO: Eliminate the lock?

func (*DefaultRouteViewCounter) Tick

func (co *DefaultRouteViewCounter) Tick() (err error)

type DefaultTopicCounter

type DefaultTopicCounter struct {
	// contains filtered or unexported fields
}
var TopicCounter *DefaultTopicCounter

func NewTopicCounter

func NewTopicCounter() (*DefaultTopicCounter, error)

func (*DefaultTopicCounter) Bump

func (co *DefaultTopicCounter) Bump()

func (*DefaultTopicCounter) Tick

func (co *DefaultTopicCounter) Tick() (e error)

type DefaultTopicViewCounter

type DefaultTopicViewCounter struct {
	// contains filtered or unexported fields
}

TODO: Use two odd-even maps for now, and move to something more concurrent later, maybe a sharded map?

var TopicViewCounter *DefaultTopicViewCounter

func NewDefaultTopicViewCounter

func NewDefaultTopicViewCounter() (*DefaultTopicViewCounter, error)

func (*DefaultTopicViewCounter) Bump

func (co *DefaultTopicViewCounter) Bump(topicID int)

func (*DefaultTopicViewCounter) Tick

func (co *DefaultTopicViewCounter) Tick() error

func (*DefaultTopicViewCounter) WeekResetInit

func (co *DefaultTopicViewCounter) WeekResetInit() error

func (*DefaultTopicViewCounter) WeekResetTick

func (co *DefaultTopicViewCounter) WeekResetTick() (e error)

type DefaultViewCounter

type DefaultViewCounter struct {
	// contains filtered or unexported fields
}

TODO: Rename this and shard it?

var GlobalViewCounter *DefaultViewCounter

TODO: Rename this?

func NewGlobalViewCounter

func NewGlobalViewCounter(acc *qgen.Accumulator) (*DefaultViewCounter, error)

func (*DefaultViewCounter) Bump

func (co *DefaultViewCounter) Bump()

func (*DefaultViewCounter) Tick

func (co *DefaultViewCounter) Tick() (err error)

TODO: Simplify the atomics used here

type MutexCounter64Bucket

type MutexCounter64Bucket struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type MutexCounterBucket

type MutexCounterBucket struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type PerfCounterBucket

type PerfCounterBucket struct {
	// contains filtered or unexported fields
}

type RVBucket

type RVBucket struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type RVCount

type RVCount struct {
	RouteID int
	Count   int64
	Avg     int
}

type RWMutexCounterBucket

type RWMutexCounterBucket struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type ReferrerItem

type ReferrerItem struct {
	Count int64
}

type SavedTick

type SavedTick struct {
	I  int
	I2 int
}

type TopicViewInsert

type TopicViewInsert struct {
	Count   int
	TopicID int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL