Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3430

Refine binary stream interchange in GridFS

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: Reactive Streams
    • Labels:
      None

      Description

      AsyncInputStream is somewhat unusual in its semantics. From the interface description, it's hard to reason how the API is supposed to work. That should be probably clarified in the documentation. I propose a simpler mechanism to consume a binary stream by using Publisher<ByteBuffer>.

      Consuming GridFs through Publisher<ByteBuffer> comes with the following characteristics:

      • Demand-oriented emission of binary chunks
      • Completion signals EOF
      • Semantics aligned with Reactive Streams

      An unsolved issue remains with pooled buffers as AsyncInputStream allows copying source content onto the provided ByteBuffer and releasing the source before emitting the written byte count. Maybe extending the concept to Publisher<T> and BiConsumer<T, ByteBuffer> (a copy/mapping function) could work.

      Thoughts?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ross.lawley Ross Lawley
              Reporter:
              mp911de Mark Paluch
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: