Batchers follow Stack like behaviour when adding items instead of Queue because we want to run the same items in the row if at all possible, to finish some items instead of getting 1 pager for every item first.
Batchers follow Stack like behaviour when adding items instead of Queue because we want to run the same items in the row if at all possible, to finish some items instead of getting 1 pager for every item first.
Mutable batching system. Batches returned can be collections or a single item.
Mutable batching system. Batches returned can be collections or a single item.
(batcher-empty? this)
Returns true if batcher is empty
Returns true if batcher is empty
(poll-batch this no-extra-input? spare-concurrency?)
Takes a batch, nil if none available
Takes a batch, nil if none available
(queue-back this item)
Adds item to batcher to the back of the queue.
Adds item to batcher to the back of the queue.
(queue-front this item)
Adds item to batcher to the front.
Adds item to batcher to the front.
(emit-batch? items-ratio
time-elapsed
no-extra-input?
spare-concurrency?
strategy)
Adaptive strategy to emit a batch.
Adaptive strategy to emit a batch. - items-ratio is ratio of size of items available vs batch size - time-elapsed is the ratio of time since last batch vs desired batch time
(non-batcher)
A batcher that doesn't batch at all. Produces single items not wrapped in collection as batches.
A batcher that doesn't batch at all. Produces single items not wrapped in collection as batches.
(time-adjusted-ratio items-ratio
time-elapsed
{:keys [min-items-ratio time-boost-start time-boost-end]})
Items ratio is ratio of size of items available vs batch size. Ratio of 1 is full batch. As time passes we adjust the ratio higher to eventually start sending partial batches.
When time-elapsed is time-boost-end, the bonus to items-ratio is equal to (1 - min-items-ratio), so no matter how much time passes, if items-ratio is below minimum, it will never be 1 or more after time adjustment.
Items ratio is ratio of size of items available vs batch size. Ratio of 1 is full batch. As time passes we adjust the ratio higher to eventually start sending partial batches. When time-elapsed is time-boost-end, the bonus to items-ratio is equal to (1 - min-items-ratio), so no matter how much time passes, if items-ratio is below minimum, it will never be 1 or more after time adjustment.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close