Documentation ¶
Index ¶
Constants ¶
const ( // WindowSize is the size of window of pending acks. WindowSize int64 = 1 << 20 // WindowMask is used to turn an ID into a slot in the window. WindowMask int64 = WindowSize - 1 )
const ( // ZipfianConstant is the default constant for the zipfian. ZipfianConstant = float64(0.99) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcknowledgedCounter ¶
type AcknowledgedCounter struct {
// contains filtered or unexported fields
}
AcknowledgedCounter reports generated integers via Last only after they have been acknoledged.
func NewAcknowledgedCounter ¶
func NewAcknowledgedCounter(start int64) *AcknowledgedCounter
NewAcknowledgedCounter creates the counter which starts at start.
func (*AcknowledgedCounter) Acknowledge ¶
func (a *AcknowledgedCounter) Acknowledge(value int64)
Acknowledge makes a generated counter vaailable via Last.
func (*AcknowledgedCounter) Last ¶
func (a *AcknowledgedCounter) Last() int64
Last implements the Generator Last interface.
type Constant ¶
type Constant struct {
// contains filtered or unexported fields
}
Constant is a trivial generator that always returns the same value.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter generates a sequence of integers. [0, 1, ...]
type Discrete ¶
type Discrete struct { Number // contains filtered or unexported fields }
Discrete generates a distribution by choosing from a discrete set of values.
type Exponential ¶
type Exponential struct { Number // contains filtered or unexported fields }
Exponential generates an exponential distribution. It produces a sequence of time intervals according to an expontential distribution.
func NewExponential ¶
func NewExponential(percentile float64, rng float64) *Exponential
NewExponential creats an exponential generator with percential and range.
func NewExponentialWithMean ¶
func NewExponentialWithMean(mean float64) *Exponential
NewExponentialWithMean creates an exponential generator with a mean arrival rate of gamma.
type Histogram ¶
type Histogram struct { Number // contains filtered or unexported fields }
Histogram generates integers according to a histogram distribution.
func NewHistogram ¶
NewHistogram creates a Histogram generator.
func NewHistogramFromFile ¶
NewHistogramFromFile creates a Histogram generator from file.
type Hotspot ¶
type Hotspot struct { Number // contains filtered or unexported fields }
Hotspot generates integers resembling a hotspot distribution where %x of operations access y% of data items.
func NewHotspot ¶
func NewHotspot(lowerBound int64, upperBound int64, hotsetFraction float64, hotOpnFraction float64) *Hotspot
NewHotspot creates a Hotspot generator. lowerBound: the lower bound of the distribution. upperBound: the upper bound of the distribution. hotsetFraction: percentage of data itme. hotOpnFraction: percentage of operations accessing the hot set.
type Number ¶
type Number struct {
LastValue int64
}
Number is a common generator.
func (*Number) SetLastValue ¶
SetLastValue sets the last value generated.
type ScrambledZipfian ¶
type ScrambledZipfian struct { Number // contains filtered or unexported fields }
ScrambledZipfian produces a sequence of items, such that some items are more popular than others, according to a zipfian distribution
func NewScrambledZipfian ¶
func NewScrambledZipfian(min int64, max int64, zipfianConstant float64) *ScrambledZipfian
NewScrambledZipfian creates a ScrambledZipfian generator.
type Sequential ¶
type Sequential struct {
// contains filtered or unexported fields
}
Sequential generates a sequence of integers 0, 1, ...
func NewSequential ¶
func NewSequential(countStart int64, countEnd int64) *Sequential
NewSequential creates a counter that starts at countStart.
func (*Sequential) Last ¶
func (s *Sequential) Last() int64
Last implements the Generator Last interface.
type SkewedLatest ¶
type SkewedLatest struct { Number // contains filtered or unexported fields }
SkewedLatest generates a popularity distribution of items, skewed to favor recent items significantly more than older items.
func NewSkewedLatest ¶
func NewSkewedLatest(basis ycsb.Generator) *SkewedLatest
NewSkewedLatest creates the SkewedLatest generator. basis is Counter or AcknowledgedCounter
type Uniform ¶
type Uniform struct { Number // contains filtered or unexported fields }
Uniform generates integers randomly.
func NewUniform ¶
NewUniform creates the Uniform generator.
type Zipfian ¶
type Zipfian struct { Number // contains filtered or unexported fields }
Zipfian generates the zipfian distribution. It produces a sequence of items, such that some items are more popular than others, according to a zipfian distribution. When you construct an instance of this class, you specify the number of items in the set to draw from, either by specifying an itemcount (so that the sequence is of items from 0 to itemcount-1) or by specifying a min and a max (so that the sequence is of items from min to max inclusive). After you construct the instance, you can change the number of items by calling Next(*rand.Rand).
Note that the popular items will be clustered together, e.g. item 0 is the most popular, item 1 the second most popular, and so on (or min is the most popular, min+1 the next most popular, etc.) If you don't want this clustering, and instead want the popular items scattered throughout the item space, then use ScrambledZipfian(located in scrambled_zipfian.go) instead.
Be aware: initializing this generator may take a long time if there are lots of items to choose from (e.g. over a minute for 100 million objects). This is because certain mathematical values need to be computed to properly generate a zipfian skew, and one of those values (zeta) is a sum sequence from 1 to n, where n is the itemcount. Note that if you increase the number of items in the set, we can compute a new zeta incrementally, so it should be fast unless you have added millions of items. However, if you decrease the number of items, we recompute zeta from scratch, so this can take a long time.
The algorithm used here is from "Quickly Generating Billion-Record Synthetic Databases", Jim Gray et al, SIGMOD 1994.
func NewZipfian ¶
NewZipfian creates the Zipfian generator.
func NewZipfianWithItems ¶
NewZipfianWithItems creates the Zipfian generator.
func NewZipfianWithRange ¶
NewZipfianWithRange creates the Zipfian generator.