Liking cljdoc? Tell your friends :D

org.clojars.roklenarcic.paginator.batcher

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.
raw docstring

Batchercljprotocol

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?clj

(batcher-empty? this)

Returns true if batcher is empty

Returns true if batcher is empty

poll-batchclj

(poll-batch this no-extra-input? spare-concurrency?)

Takes a batch, nil if none available

Takes a batch, nil if none available

queue-backclj

(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-frontclj

(queue-front this item)

Adds item to batcher to the front.

Adds item to batcher to the front.
sourceraw docstring

emit-batch?clj

(emit-batch? items-ratio
             time-elapsed
             no-extra-input?
             spare-concurrency?
             strategy)

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
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
sourceraw docstring

grouped-batcherclj

(grouped-batcher grouping-fn n strategy)
source

non-batcherclj

(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.
sourceraw docstring

time-adjusted-ratioclj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close