-
Notifications
You must be signed in to change notification settings - Fork 16
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
Batch data object fetching for mcclient #123
Conversation
6e586d0
to
a82aafd
Compare
It fails to handle null data objects correctly -- these are returned by the batch interface when the object is not found in the datastore:
|
}) | ||
stream.on('error', (err) => { | ||
stdout.write(`}\n`) | ||
reject(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this print the actual error in stderr or something similar? It would be nice not to swallow dem errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it will print the error message to stderr if you reject a promise, and set the exit status code to 1. It's part of the subcommand
helper thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, cool, this is precisely the desired behaviour.
stdout.write(`}\n`) | ||
reject(err) | ||
}) | ||
stream.on('end', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems unnecessary -- or is the code reused from the data protocol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to resolve the promise at the end of the stream, so we can close the ssh tunnel if it exists and end the process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there something emitting an 'end' object on EOF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the fetch request body stream will send the end
event once you've consumed the whole thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok cool -- I didn't know that.
Adds support for the batch get support added in mediachain/concat#100
The
mcclient data get
command now accepts multiple keys and will fetch them with the batch interface.Right now it prints the returned objects directly to the console one after another; I'm torn on whether we should wrap them in an array literal first, so that the entire output would be valid JSON.