Reactive Slick

Here's the ongoing work on Reactive Slick.

/cc @cvogt for review later
And, to add to Roland comment.
Above Long.MAX_VALUE in flight demand is a sign of a broken Subscriber
(since it is able to know how much has been requested and how much was
delivered so far), which is what this rule is trying to detect and handle.

-- 
Cheers,
√
On 16 Dec 2014 14:13, "Roland Kuhn" <notifications@github.com> wrote:

> In src/main/scala/scala/slick/backend/DatabaseComponent.scala
> <https://github.com/slick/slick/pull/1021#discussion-diff-21896013>:
>
> > +      if(s ne null) {
> > +        streamState = null
> > +        if(streamLogger.isDebugEnabled) streamLogger.debug("Scheduling stream continuation after transition from demand = 0")
> > +        val a = streamingAction
> > +        database.scheduleSynchronousStreaming(a, this)(s.asInstanceOf[a.StreamState])
> > +      } else {
> > +        if(streamLogger.isDebugEnabled) streamLogger.debug("Saw transition from demand = 0, but no stream continuation available")
> > +      }
> > +    }
> > +
> > +    ////////////////////////////////////////////////////////////////////////// Subscription methods
> > +
> > +    def request(l: Long): Unit = if(!cancelRequested) {
> > +      if(l <= 0)
> > +        throw new IllegalArgumentException("Requested count must not be <= 0 (see Reactive Streams spec, 3.9)")
> > +      else if(requested + l < 0) {
>
> Well, the “don’t work” part is definitely incorrect, what you are getting
> at is that with such a scheme the Publisher would detect less error cases
> than strictly possible. But what we are describing here is a mechanism for
> transferring data over an asynchronous boundary, which means that arbitrary
> delays are possible and expected.
>
> To make it very concrete: the part “… but for the handshake between the
> publishing thread and request() …” is not mandated, and for performance
> reasons we should leave it out. Yes, this means that more than
> Long.MaxValue demand can be in flight, but I don’t see that as a problem.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/slick/slick/pull/1021/files#r21896013>.
>