scp: add option types + *WithOpts functions #24234
Closed
+301
−114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Priot to this commit, many scp functions existed without option structs, which would make extending functionality (adding new options) impossible without breaking changes, or without adding redundant wrapper functions.
This commit adds in new option types for various scp related functions. It also adds relevant *WithOpts counterparts to existing functions, which use these new option types.
This commit also adds in an experimental
ScpWithOpts
function to image engine implementations, which should eventually replace the existingImageEngine.Scp()
function. However, this replacement can't be done without breaking theImageEngine
interface, so it should happen at a later major version upgrade.The commit also renames the existing
ImageScpOptions
entity type toScpTransferImageOptions
, and adds an alias mapping the old to the new name to prevent breakage. This is because the previousImageScpOptions
was inaccurate, as it is not the actual options forImageEngine.Scp()
. The new name is more accurate. Also, if the signature ofImageEngine.Scp()
is eventually changed to matchScpWithOpts
as discussed above,ImageScpBaseOptions
could then be more accurately renamed toImageScpOptions
This commit SHOULD NOT introduce any breaking changes. The breakages could be made in a later commit that would replace the existing functions with the *WithOpts counterparts.
Does this PR introduce a user-facing change?