A minimal recreation of generators for simulated DB ops. We're not doing anything fancy with context or causality here; generators are just plain old seqs.
These versions use clojure.data.gen for RNGs, so they're deterministic.
A minimal recreation of generators for simulated DB ops. We're not doing anything fancy with context or causality here; generators are just plain old seqs. These versions use clojure.data.gen for RNGs, so they're deterministic.
(append-txns opts)
Like wr-txns, we just rewrite writes to be appends.
Like wr-txns, we just rewrite writes to be appends.
(fresh-key active-keys k)
Takes a key and a vector of active keys. Returns the vector with that key replaced by a fresh key.
Takes a key and a vector of active keys. Returns the vector with that key replaced by a fresh key.
A map of generator names to constructor fns.
A map of generator names to constructor fns.
(key-dist-scale key-dist-base key-count)
Takes a key-dist-base and a key count. Computes the scale factor used for random number selection used in rand-key.
Takes a key-dist-base and a key count. Computes the scale factor used for random number selection used in rand-key.
(list-append)
(list-append opts)
A generator for operations where values are transactions made up of reads and appends to various integer keys. Takes options:
:key-count Number of distinct keys at any point :min-txn-length Minimum number of operations per txn :max-txn-length Maximum number of operations per txn :max-writes-per-key Maximum number of operations per key
For defaults, see wr-txns.
A generator for operations where values are transactions made up of reads and appends to various integer keys. Takes options: :key-count Number of distinct keys at any point :min-txn-length Minimum number of operations per txn :max-txn-length Maximum number of operations per txn :max-writes-per-key Maximum number of operations per key For defaults, see wr-txns.
(rand-key key-dist key-dist-base key-dist-scale active-keys)
Helper for generators. Takes a key distribution (e.g. :uniform or :exponential), a key distribution scale, a key distribution base, and a vector of active keys. Returns a random active key.
Helper for generators. Takes a key distribution (e.g. :uniform or :exponential), a key distribution scale, a key distribution base, and a vector of active keys. Returns a random active key.
(txn-gen txns)
Takes a sequence of transactions and returns a sequence of invocation operations.
Takes a sequence of transactions and returns a sequence of invocation operations.
(wr-txns opts)
(wr-txns opts state)
A lazy sequence of write and read transactions over a pool of n numeric keys; every write is unique per key. Options:
:key-dist Controls probability distribution for keys being selected for a given operation. Choosing :uniform means every key has an equal probability of appearing. :exponential means that key i in the current key pool is k^i times more likely than the first key to be chosen. Defaults to :exponential.
:key-dist-base The base for an exponential distribution. Defaults to 2, so the first key is twice as likely as the second, which is twice as likely as the third, etc.
:key-count Number of distinct keys at any point. Defaults to 10 for exponential, 3 for uniform.
:min-txn-length Minimum number of operations per txn
:max-txn-length Maximum number of operations per txn
:max-writes-per-key Maximum number of operations per key
A lazy sequence of write and read transactions over a pool of n numeric keys; every write is unique per key. Options: :key-dist Controls probability distribution for keys being selected for a given operation. Choosing :uniform means every key has an equal probability of appearing. :exponential means that key i in the current key pool is k^i times more likely than the first key to be chosen. Defaults to :exponential. :key-dist-base The base for an exponential distribution. Defaults to 2, so the first key is twice as likely as the second, which is twice as likely as the third, etc. :key-count Number of distinct keys at any point. Defaults to 10 for exponential, 3 for uniform. :min-txn-length Minimum number of operations per txn :max-txn-length Maximum number of operations per txn :max-writes-per-key Maximum number of operations per key
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close