[JAVA-3430] Refine binary stream interchange in GridFS Created: 17/Jan/19  Updated: 28/Oct/23  Resolved: 13/Dec/19

Status: Closed
Project: Java Driver
Component/s: Reactive Streams
Affects Version/s: None
Fix Version/s: 4.0.0

Type: New Feature Priority: Major - P3
Reporter: Mark Paluch Assignee: Ross Lawley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 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?



 Comments   
Comment by Githook User [ 15/Jan/20 ]

Author:

{'name': 'Ross Lawley', 'username': 'rozza', 'email': 'ross.lawley@gmail.com'}

Message: GridFS API improvements

JAVA-3430
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/664d066733d3e5e99b37f8db6931362919e879c2

Comment by Ross Lawley [ 11/Dec/19 ]

PR: https://github.com/rozza/mongo-java-driver/pull/340

Comment by Ross Lawley [ 26/Nov/19 ]

Added JAVARS-222 to handle the pre 4.x work

Comment by Jeffrey Yemin [ 20/Nov/19 ]

ross.lawley. we can use this ticket for the 4.x port, but we should have a JAVARS ticket for the 1.13 work.

Comment by Ross Lawley [ 20/Nov/19 ]

PR: https://github.com/rozza/mongo-java-driver-reactivestreams/pull/21

Comment by Mark Paluch [ 28/Jan/19 ]

I linked the Spring Data MongoDB integration that accepts and exposes binary streams through a Reactive Streams Publisher.

Generated at Thu Feb 08 08:59:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.