Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make success sequence return each result as an element in the stream #161

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

danielcompton
Copy link
Collaborator

In the official RethinkDB drivers, success sequence's return a single row in each element. This is a fairly natural model, and hides the fact that some results are returned in chunks. Currently, success sequence results are put onto the core.async channel as a single value. Would you be open to changing the model to match how the official drivers do it?

@apa512
Copy link
Owner

apa512 commented May 13, 2016

Just to make sure I understand: do you mean that async operations (except for changefeeds) return a cursor (which can be used like a lazy seq) on the channel as opposed to one item at a time?

I considered the second option but decided against it because I couldn't find a convenient way to get all items from the channel, which is usually what I want.

@danielcompton
Copy link
Collaborator Author

danielcompton commented May 13, 2016

Currently, if you get a stream back (either success sequence, or success partial), all of the rows in the stream are put as one 'item' on the core.async channel. I'm suggesting that each row is put on as a separate item on the channel.

Currently:

[    [  [row 1] [row 2] [row 3]  ]  [ [row 4] [row 5] [row 6] ]     ]

In the future:

[  [row 1] [row 2] [row 3] [row 4] [row 5] [row 6]  ]

You can use (core.async/into ch []) which returns a go block with the contents of chan in the vector, which I think is what you're after.

The failing tests that I've implemented demonstrate the behaviour I'm looking for.

They are the same function, but decode-stream is the 'master', and
decode-channel has been def'd to equal decode-stream.
In an async query, success sequence and success partial rows are put
on the channel row by row. This means that the consumer can be unaware
of the batching that takes place between the driver and RethinkDB.
@lenaschoenburg
Copy link
Contributor

Are you still working on this?/Can I help in some way? The new behaviour would be immensely helpful for code that does not need to distinguish between changefeeds and sequences.

@apa512
Copy link
Owner

apa512 commented Jul 1, 2016

I plan to implement this but I'm not sure how soon. Probably in a week or two.

@lenaschoenburg
Copy link
Contributor

Great, thank you very much!

@danielcompton
Copy link
Collaborator Author

I also hope to get to it in a week or so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants