Class/Object

com.twitter.algebird

Batched

Related Docs: object Batched | package algebird

Permalink

sealed abstract class Batched[T] extends Serializable

Batched: the free semigroup.

For any type T, Batched[T] represents a way to lazily combine T values as a semigroup would (i.e. associatively). A Semigroup[T] instance can be used to recover a T value from a Batched[T].

Like other free structures, Batched trades space for time. A sum of batched values defers the underlying semigroup action, instead storing all values in memory (in a tree structure). If an underlying semigroup is available, Batched.semigroup and Batch.monoid can be configured to periodically sum the tree to keep the overall size below batchSize.

Batched[T] values are guaranteed not to be empty -- that is, they will contain at least one T value.

Source
Batched.scala
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Batched
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def size: Int

    Permalink

    Report the size of the underlying tree structure.

    Report the size of the underlying tree structure.

    This is an O(1) operation -- each subtree knows how big it is.

  2. abstract def sum(implicit sg: Semigroup[T]): T

    Permalink

    Sum all the T values in this batch using the given semigroup.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def append(that: TraversableOnce[T]): Batched[T]

    Permalink

    Add more values to a batched value.

    Add more values to a batched value.

    This method will grow the tree to the left.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def combine(that: Batched[T]): Batched[T]

    Permalink

    Combine two batched values.

    Combine two batched values.

    As mentioned above, this just creates a new tree structure containing this and that.

  8. def compact(batchSize: Int)(implicit s: Semigroup[T]): Batched[T]

    Permalink

    Compact this batch if it exceeds batchSize.

    Compact this batch if it exceeds batchSize.

    Compacting a branch means summing it, and then storing the summed value in a new single-item batch.

  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. def iterator: Iterator[T]

    Permalink

    Provide an iterator over the underlying tree structure.

    Provide an iterator over the underlying tree structure.

    This is the order used by .sum.

    This iterator traverses the tree from left-to-right. If the original expression was (w + x + y + z), this iterator returns w, x, y, and then z.

  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def reverseIterator: Iterator[T]

    Permalink

    Provide a reversed iterator over the underlying tree structure.

    Provide a reversed iterator over the underlying tree structure.

    This iterator traverses the tree from right-to-left. If the original expression was (w + x + y + z), this iterator returns z, y, x, and then w.

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toList: List[T]

    Permalink

    Convert the batch to a List[T].

  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped