package batches
- Alphabetic
- Public
- Protected
Type Members
- final class ArrayBatch[A] extends Batch[A]
Batch implementation that wraps an array, based on ArrayCursor.
- final class ArrayCursor[A] extends BatchCursor[A]
BatchCursor type that works over an underlying
Array
.BatchCursor type that works over an underlying
Array
.NOTE: all transformations happen by copying from the source array into a modified copy, hence all transformations have strict behavior!
To build an instance, prefer
BatchCursor.fromArray
. - abstract class Batch[+A] extends Serializable
The
Batch
is a BatchCursor factory, similar in spirit with Scala's Iterable.The
Batch
is a BatchCursor factory, similar in spirit with Scala's Iterable.Its cursor() method can be called repeatedly to yield the same sequence.
This class is provided as an alternative to Scala's Iterable because:
- the list of supported operations is smaller
- implementations specialized for primitives are provided to avoid boxing
- it's a factory of BatchCursor, which provides hints
for
recommendedBatchSize
, meaning how many batch can be processed in a batches
Used in the Iterant implementation.
- abstract class BatchCursor[+A] extends Serializable
Similar to Java's and Scala's
Iterator
, theBatchCursor
type can can be used to iterate over the data in a collection, but it cannot be used to modify the underlying collection.Similar to Java's and Scala's
Iterator
, theBatchCursor
type can can be used to iterate over the data in a collection, but it cannot be used to modify the underlying collection.Inspired by the standard
Iterator
, provides a way to efficiently apply operations such asmap
,filter
,collect
on the underlying collection without such operations having necessarily lazy behavior. So in other words, when wrapping a standardArray
, an application ofmap
will copy the data to a newArray
instance with its elements modified, immediately and is thus having strict (eager) behavior. In other cases, when wrapping potentially infinite collections, likeIterable
orStream
, that's when lazy behavior happens.Sample:
def sum(cursor: BatchCursor[Int]): Long = { var sum = 0L while (cursor.hasNext()) { sum += cursor.next() } sum }
This class is provided as an alternative to Scala's Iterator because:
- the list of supported operations is smaller
- implementations specialized for primitives are provided to avoid boxing
- depending on the implementation, the behaviour of operators
can be eager (e.g.
map
,filter
), but only in case the source cursor doesn't need to be consumed (if the cursor is backed by an array, then a new array gets created, etc.) - the
recommendedBatchSize
can signal how many batch can be processed in batches
Used in the Iterant implementation.
- final class BooleansBatch extends Batch[Boolean]
Batch implementation specialized for
Boolean
.Batch implementation specialized for
Boolean
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingBooleansBatch
might be desirable instead forisInstanceOf
checks. - final class BooleansCursor extends BatchCursor[Boolean]
BatchCursor implementation specialized for
Boolean
.BatchCursor implementation specialized for
Boolean
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingBooleansCursor
might be desirable instead forisInstanceOf
checks. - final class BytesBatch extends Batch[Byte]
Batch implementation specialized for
Byte
.Batch implementation specialized for
Byte
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingBytesBatch
might be desirable instead forisInstanceOf
checks. - final class BytesCursor extends BatchCursor[Byte]
BatchCursor implementation specialized for
Byte
.BatchCursor implementation specialized for
Byte
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingBytesCursor
might be desirable instead forisInstanceOf
checks. - final class CharsBatch extends Batch[Char]
Batch implementation specialized for
Char
.Batch implementation specialized for
Char
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingCharsBatch
might be desirable instead forisInstanceOf
checks. - final class CharsCursor extends BatchCursor[Char]
BatchCursor implementation specialized for
Char
.BatchCursor implementation specialized for
Char
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingCharsCursor
might be desirable instead forisInstanceOf
checks. - final class DoublesBatch extends Batch[Double]
Batch implementation specialized for
Double
.Batch implementation specialized for
Double
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingDoublesBatch
might be desirable instead forisInstanceOf
checks. - final class DoublesCursor extends BatchCursor[Double]
BatchCursor implementation specialized for
Double
.BatchCursor implementation specialized for
Double
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingDoublesCursor
might be desirable instead forisInstanceOf
checks. - abstract class GenericBatch[+A] extends Batch[A]
Reusable Batch base class that can be used for implementing generators that simply modify their underlying cursor reference.
- abstract class GenericCursor[+A] extends BatchCursor[A]
Reusable BatchCursor base class that can be used for implementing cursors by just providing the primitive operations,
hasNext
,next
andrecommendedBatchSize
. - final class IntegersBatch extends Batch[Int]
Batch implementation specialized for
Int
.Batch implementation specialized for
Int
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingIntegersBatch
might be desirable instead forisInstanceOf
checks. - final class IntegersCursor extends BatchCursor[Int]
BatchCursor implementation specialized for
Int
.BatchCursor implementation specialized for
Int
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingIntegersCursor
might be desirable instead forisInstanceOf
checks. - final class IteratorCursor[+A] extends BatchCursor[A]
BatchCursor type that works over an underlying
Iterator
.BatchCursor type that works over an underlying
Iterator
.NOTE: all transformations are delegated to the underlying
Iterator
and may thus have lazy behavior. - final class LongsBatch extends Batch[Long]
Batch implementation specialized for
Long
.Batch implementation specialized for
Long
.Under the hood it uses an ArrayBatch implementation, which is
@specialized
. UsingLongsBatch
might be desirable instead forisInstanceOf
checks. - final class LongsCursor extends BatchCursor[Long]
BatchCursor implementation specialized for
Long
.BatchCursor implementation specialized for
Long
.Under the hood it uses an ArrayCursor implementation, which is
@specialized
. UsingLongsCursor
might be desirable instead forisInstanceOf
checks. - final class SeqBatch[+A] extends Batch[A]
Value Members
- object Batch extends Serializable
Batch builders.
- object BatchCursor extends Serializable
BatchCursor builders.
- object EmptyBatch extends Batch[Nothing]
Reusable Batch implementation that's always empty.
- object EmptyCursor extends BatchCursor[Nothing]
BatchCursor implementation that's always empty.
This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomic
types, as alternative tojava.util.concurrent.atomic
monix.catnap exposes pure abstractions built on top of the Cats-Effect type classes:
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.tail exposes Iterant for purely functional pull based streaming:
Batch
andBatchCursor
, the alternatives to Scala'sIterable
andIterator
respectively that we are using within Iterant's encodingYou can control evaluation with type you choose - be it Task, Coeval, cats.effect.IO or your own as long as you provide correct cats-effect or cats typeclass instance.