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

Refine binary stream interchange in GridFS

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

      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?

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

              Created:
              Updated:
              Resolved: