Documentation
¶
Overview ¶
Copyright (c) 2018-2024 Jean-Francois SMIGIELSKI Copyright (c) 2024 OVHCloud SAS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadCSV = errors.New("bad CSV line")
var ErrBadSize = errors.New("negative size configured")
var ErrBadWeight = errors.New("negative weight configured")
var ErrEmpty = errors.New("no size configured")
Functions ¶
This section is empty.
Types ¶
type Int64Distribution ¶ added in v0.0.2
type Int64Distribution interface {
// Produces a new int64 respecting the distribution and based on the given uniform PRNG
Poll(r *rand.Rand) int64
}
func NewSizeHistograms ¶
func NewSizeHistograms(sizes []Int64HistogramBar) (Int64Distribution, error)
NewSizeHistograms returns a Int64Distribution implementing histogram-like buckets, ready to use and based on a collection of size bars
func ParseCSV ¶
func ParseCSV(csv string) (Int64Distribution, error)
ParseCSV returns a Int64Distribution implementing histogram-like buckets, ready to use and based on a collection of size bars described as a coma-separated sequence of "size:weight" values
func ParseTokens ¶
func ParseTokens(pairs []string, separator string) (Int64Distribution, error)
ParseTokens returns a Int64Histogram ready to use, based on a collection of size bars stored in an array of "size <separator> weight" tokens