RUST-1025 Async versions of Document::from_reader
and Document::to_writer
#304
Labels
tracked-in-jira
Ticket filed in Mongo's Jira system
Actually, I don't if this is a right way..
Let's say that I want to design a custom
client/server
, which usesbson
to transfer data(like mongodb oplog or my custom defined data). ButDocument::from_reader
andDocument::to_writer
is not async function, I can hardly to use it directly to send/receive data (or may cause the whole event loop hang).As alternative, I need to read data into a
vector<u8>
, then invokeDocument::from_reader
to get actual document. But using this method, I need to parse the input stream(like read header first to know how many bytes we need to read at least).So may be there are some relative apis to make
async read/write
directlyfrom/into
a Document is awesome.But actually I don't know if serialize and deserialize document is a cpu bound task. If this is a cpu bound task, it's useless to implement these methods.
I have checked
mongodb rust driver
implementation, it seems that it use another abstractMessage
to make async interactive with mongodb. (I believe these data are also in bson format):https://github.com/mongodb/mongo-rust-driver/blob/master/src/cmap/conn/wire/message.rs#L24
May I ask what do you think about this?
The text was updated successfully, but these errors were encountered: