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

Refine binary stream interchange in GridFS

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.0.0
    • None
    • Reactive Streams
    • 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

        Activity

          People

            ross@mongodb.com Ross Lawley
            mp911de Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: