pool

package
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncAdd

type FuncAdd func(metric libmet.Metric) error

type FuncGet

type FuncGet func(name string) libmet.Metric

type FuncSet

type FuncSet func(key string, metric libmet.Metric)

type FuncWalk

type FuncWalk func(pool MetricPool, key string, val libmet.Metric) bool

type MetricPool

type MetricPool interface {
	// Get is used to retrieve the metric instance from the pool.
	Get(name string) libmet.Metric

	// Add is used to register the metric instance into the pool.
	Add(metric libmet.Metric) error

	// Set is used to replace the metric instance into the pool.
	Set(key string, metric libmet.Metric)

	// Del is used to remove the metric instance into the pool.
	Del(key string)

	// List retrieve a slice of metrics' name registered into the pool.
	List() []string

	// Walk run the given function for each stored item into the pool.
	// If the function return false, the process is stopped.
	Walk(fct FuncWalk, limit ...string) bool
}

func New

func New(ctx libctx.FuncContext) MetricPool

Jump to

Keyboard shortcuts

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