stats

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStatsObject

type MockStatsObject struct {
	Id    uint64 `json:"key"`
	Count int    `json:"count"`
	Size  int64  `json:"size"`
	// contains filtered or unexported fields
}

func (*MockStatsObject) Increment

func (m *MockStatsObject) Increment(key string, count int, size int64) error

func (*MockStatsObject) Initialize

func (m *MockStatsObject) Initialize() error

func (*MockStatsObject) Key

func (m *MockStatsObject) Key() uint64

func (*MockStatsObject) Matches

func (m *MockStatsObject) Matches(other StatsObject) bool

type StatsCombiner

type StatsCombiner[T StatsObject] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStatsCombiner

func NewStatsCombiner[T StatsObject](
	db *bbolt.DB,
	bucketBase string,
	now time.Time,
	interval time.Duration,
	serializer func(T) ([]byte, error),
	deserializer func([]byte) (T, error),
) *StatsCombiner[T]

func (*StatsCombiner[T]) Record

func (sc *StatsCombiner[T]) Record(now time.Time, item T, incKey string, count int, logSize int64) (map[uint64][]T, error)

type StatsObject

type StatsObject interface {
	Key() uint64
	Matches(other StatsObject) bool
	Increment(key string, count int, size int64) error
	Initialize() error
}

Jump to

Keyboard shortcuts

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