SwayDB icon indicating copy to clipboard operation
SwayDB copied to clipboard

Support external Streaming libraries

Open simerplaha opened this issue 6 years ago • 0 comments

Internal Stream is a very basic Stream implementation (intentional) which makes it easier to interop with Java. Akka Streams, FS2, Scalaz-stream, ZIO-streams etc should all be supported.

Currently each database instance can produce the following Streamer type (similar to an Iterator[T]). This type basically starts iteration from head and fetches the next item in the Stream given the previously read item on request.

trait Streamer[A, T[_]] {
  def head: T[Option[A]]
  def next(previous: A): T[Option[A]]
}

If there is a way to interop with all other streaming libraries given the above type then supporting others will be easier.

Reactive Stream is another way to support interop but is complex to implement see #57.

simerplaha avatar Dec 20 '19 10:12 simerplaha