QueueBufferedPersistentMapConfig

data class QueueBufferedPersistentMapConfig<BufferedItems, MapKeyType, MapValueType>(    val queue: PersistentQueue<BufferedItems>,     val map: PersistentMap<MapKeyType, MapValueType>,     val groupByBlock: (BufferedItems) -> MapKeyType,     val defaultValue: (MapKeyType) -> MapValueType,     val mergeBlock: (MapValueType, BufferedItems) -> MapValueType,     val delay: Long,     val buffer: Boolean = false)

Constructors

Link copied to clipboard
fun <BufferedItems, MapKeyType, MapValueType> QueueBufferedPersistentMapConfig(    queue: PersistentQueue<BufferedItems>,     map: PersistentMap<MapKeyType, MapValueType>,     groupByBlock: (BufferedItems) -> MapKeyType,     defaultValue: (MapKeyType) -> MapValueType,     mergeBlock: (MapValueType, BufferedItems) -> MapValueType,     delay: Long,     buffer: Boolean = false)

Properties

Link copied to clipboard
val buffer: Boolean = false

Whether or not to enable buffering. When this is true, the map will first buffer each of the BufferedItems in a queue and asynchronously work through that. When this is false, the items are reduced into the MapValueType as they come in, one by one.

Link copied to clipboard
val defaultValue: (MapKeyType) -> MapValueType

The default value used in reduces while merging all of the BufferedItems into an existing (or non existing) MapValueType for a given key.

Link copied to clipboard
val delay: Long

The amount of time to wait before processing buffered items into the map. This should basically be changed while tuning to achieve some performance target. The default tries to ensure that you don't rapidly process everything in the queue while things are still coming in, leading to lots of little processing requests when it could have all been done in a single go.

Link copied to clipboard
val groupByBlock: (BufferedItems) -> MapKeyType

Logic for grouping buffered items into groups, keyed off of the MapKeyType. Everything that is buffered will eventually make its way into the map. In order to know what key to use in the map, everything in the buffer is grouped according to this function.

Link copied to clipboard
val map: PersistentMap<MapKeyType, MapValueType>
Link copied to clipboard
val mergeBlock: (MapValueType, BufferedItems) -> MapValueType

Logic for determining how to transform an item in the buffer into an item that the map stores, and how to reconcile that converted value with the current value in the map if there is one.

Link copied to clipboard
val queue: PersistentQueue<BufferedItems>