An outline of the Stream and Collection API provided by Pitchforc data source backends.

The API has several levels:

  • Stream[T]: A potentially unbounded stream of Ts. Supports filter, map, flatMap, each, snapshot. Does not support size, orderBy. each() only halts when the stream ends (which may never happen). snapshot() returns a all the elements of the stream up to the current time. All operations on streams return streams, except snapshot which returns a Collection[T].
  • Collection[T]: A bounded collection of Ts. Subclass of Stream[T]. Add support for size, orderBy. each() publishes values over time, but always terminated eventually. size() may not publish until each() has terminated. Operations do not maintain order and different iterations may be in different orders. orderBy returns a Sequence[T].
  • Ordered[T]: An ordered stream/collection of Ts. All operations maintain element order, but may execute closure calls in concurrently with one another. Provides "*Seq" versions of method which operate in sequential order without concurrency or parallelism. These operations are useful if the closure passed to them has side-effects. This can be combined with either Stream or Collection.
  • Mutable[T]: A stream/collection to which elements can be added. The position they are added in the sequence is always the end if the stream or sequence is ordered. This can be combined with either Stream or Collection. Elements cannot be removed.
  • Reuseable: A stream that can be used more that once. This means that it can be iterated more than once and that other operations do not invalidate the stream.

Possible other classes:

  • IndexMutable[T]: A stream/collection to which elements can be added with specific positions. Elements can be added at any index. Elements can be moved from one position to another. Elements cannot be removed. This iterface does not make much sense on
  • Indexable[T]: A steam/collection in which elements can be requested be index from the beginning. These will almost always be reusable, but that is not required. If they are not reusable any call to get an index will invalidate the stream unless the specific implementation allows further usage.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 09-Apr-2017 19:53 by Arthur Peters