Return UploadPlan struct from upload_parameters#799
Open
demoray wants to merge 1 commit into
Open
Conversation
calc_concurrency and upload_parameters returned a positional
(NonZeroU64, NonZeroUsize). Both values are non-zero positive
integers; nothing at the call site or in the tests prevented a
swapped destructure beyond the type difference, and that protection
disappears the first time anyone aligns the two on a single integer
type.
Introduce a private UploadPlan { block_size, concurrency } so the
single call site reads field-named, and rewrite the five
plan-returning tests to assert against a whole UploadPlan literal
instead of two positional bindings plus two assert_eq! lines each.
The Error::TooLarge test is unchanged.
Verified with:
- cargo fmt --check
- cargo clippy --all-features --all-targets -- -D warnings
- cargo test --all-features
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
calc_concurrencyandupload_parametersinsrc/upload/blobstore.rsreturned a positional
(NonZeroU64, NonZeroUsize). Both values arenon-zero positive integers; nothing at the call site or in the tests
prevented a swapped destructure beyond the type difference, and that
protection disappears the first time anyone aligns the two on a
single integer type.
Introduce a private
UploadPlan { block_size, concurrency }so thesingle call site (
BlobUploader::upload_file) reads field-named:Rewrite the five plan-returning tests to assert against a whole
UploadPlanliteral instead of two positional bindings plus twoNo behavior change. Public API unchanged —
UploadPlanandupload_parametersare both private.Verified with:
cargo fmt --checkcargo clippy --all-features --all-targets -- -D warningscargo test --all-features