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

Support remote download of files when doing a File.Get #11

Merged
merged 4 commits into from
Jul 30, 2018
Merged

Conversation

ejbrever
Copy link
Contributor

@aashaikh @robshakir Can you please review this?

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Eric -- few clarifications.

file/file.proto Outdated
@@ -18,6 +18,7 @@ syntax = "proto3";

package gnoi.file;

import "third_party/openconfig/gnoi/common.proto";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct this import path :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :)

file/file.proto Outdated
// where to transfer the data. The remote_file must be an absolute path to a
// file.
message GetRemoteRequest {
string remote_file = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this remote_file tally with the path in the RemoteDownload message?

I'd have thought that the required field in this message would be the local file to which the remote file is being downloaded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, agree this is a bit confusing and the docs don't help :)

The intention was RemoteDownload specified how to get the file, and this was supposed to specify the path name in the device to save it to (i.e. /tmp/os-1.0).

Maybe local_file be a better name and I can update the descriptions as well. Please let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - something like local_path would probably make more sense here IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

@@ -24,6 +24,7 @@ syntax = "proto3";

package gnoi.system;

import "third_party/openconfig/gnoi/common.proto";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix import path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

common.proto Outdated

package gnoi;

import "third_party/openconfig/gnoi/types.proto";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import path cleanup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, thanks.

@@ -28,6 +29,13 @@ service File {
// if the file does not exist or there was an error reading the file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Get reads and streams ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -305,7 +285,7 @@ message Package {
// For system packages this will take effect after reboot.
bool activate = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still wonder if activate is the right name for this field -- to me a true value here could be interpreted as "make this package active now". does something like requires_reboot make sense ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am open to a new name, just not sure what that might be :)

For more context, when you transfer a file, the file can be stored on the device, but not applied. So after transferring a file (without activation) a reboot of the device would not set the package to active. You have to specify somehow to set a specific package active.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm getting hung up on the "reboot" part of this -- maybe we can change the comment to say something like:

Indicates that the package should be made active after receipt on the device.
For system image packages, the new image is expected to be active after a reboot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

Copy link
Contributor

@aghaffarkhah aghaffarkhah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I can 2 small comments as well.


// RemoteDownload defines the details for a device to initiate a file transfer
// from or to a remote location.
message RemoteDownload {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I missed this, but why do you think this message is common to all the services? What is the reason behind creating this file? Sorry this is just me understanding...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem at all. It was originally in system.proto. In this change we wanted to add it to file.proto as well so it made sense to put it in a common place.

file/file.proto Outdated
// An error is returned if the file does not exist, the file transfer fails,
// or if there was an error reading the file. This is a blocking call until
// the file transfer is complete.
rpc GetRemote(GetRemoteRequest) returns (GetRemoteResponse) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldnt "TransferToRemote" or something similar a better name? Sorry not trying to be obsessed with the name, but having "Get" in the name of the RPC is a bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty open to a different name. Maybe TransferFromRemote would be more obvious here?

@aashaikh @robshakir Any thoughts on the name here as well? I know we had discussed this previously as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with TransferFromRemote or even FetchRemote here, but I don't have strong feelings.

The "get" in GetRemote is essentially "get this file from a remote place" - maybe fetch is better than "get" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning towards TransferFromRemote, but please let me know if you feel otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking again about it, I agree with @aghaffarkhah on TransferToRemote :)

I have updated using this name now. I think this is much more obvious than GetRemote.

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weighing in on the naming discussion - but LGTM.

file/file.proto Outdated
// An error is returned if the file does not exist, the file transfer fails,
// or if there was an error reading the file. This is a blocking call until
// the file transfer is complete.
rpc GetRemote(GetRemoteRequest) returns (GetRemoteResponse) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with TransferFromRemote or even FetchRemote here, but I don't have strong feelings.

The "get" in GetRemote is essentially "get this file from a remote place" - maybe fetch is better than "get" here?

@ejbrever
Copy link
Contributor Author

@robshakir @aghaffarkhah Can you please take another look?

Thanks,
Eric

@ejbrever ejbrever merged commit 5a06ffc into master Jul 30, 2018
@ejbrever ejbrever deleted the download branch July 30, 2018 18:35
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.

4 participants