Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoShardFn = errors.New("no shard function provided in constructor") ErrZeroShardCount = errors.New("can't create histogram with zero shards") )
Errors returned by New.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is a generic histogram implementation intended for use in concurrent environment. All methods are goroutine-safe. Zero value and nil are not valid Histograms.
func New ¶
New creates a new histogram. It can panic if the shardsCount is more than runtime can handle (i.e. slice size limit).
func WithDefaultHash ¶
WithDefaultHash creates histogram with specified shardCount and reasonable sharding function.
func (*Histogram) Add ¶
Add increments counter associated with the specified key by the amount specified.
func (*Histogram) Count ¶
Count calculates the number of elements in histogram in a more efficient way that can be implemented with VisitAll
Click to show internal directories.
Click to hide internal directories.