Repository navigation
feat(b2): compose large files from uploaded and copied parts - #129
Open
ffumero2003 wants to merge 2 commits into
Open
ffumero2003 wants to merge 2 commits into
ffumero2003 wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Context
blazer could upload a large file only through the streaming
Writer(local bytes), andb2_copy_partwas wrapped nowhere — so it could not compose a large file from mixed sources.large.compose_mixedreadnoon the parity card.Changes
base.LargeFile.CopyPartwrapsb2_copy_part(POST .../b2_copy_part, body{sourceFileId, largeFileId, partNumber, range?}), recording the part sha1/size under the large file's lock — reusing the existingFinishLargeFileassembly untouched.CopyPartRequest/CopyPartResponseininternal/b2types.copyPartplumbed through both large-file interfaces (incl. the retry wrapper).b2.Bucket.Compose(ctx, name, parts ...ComposePart)building a large file from an ordered mix of uploaded parts (PartFromReader) and server-side copied ranges (PartFromCopy); validates the B2 part rules (≥2 parts, every part except the last ≥5 MB) and cancels the large file on error.CopyPartbut not marshaled (SSE-C is not on main).Stored-part/resume seeding is intentionally out of scope (that is
Writer.Resume).Verification
go build ./...— clean.go test ./base/... ./b2/... ./internal/... -race— green, incl. ab2_copy_partbody test and compose wire tests (mixed / copy-only / upload-only, validation table, error-cancels-large-file).golangci-lint run --new-from-rev=origin/main ./...— 0 issues.large.compose_mixed@simulator — PASS.blazer-go-demo compose): a 5,000,000-byte uploaded part + a server-side copied range compose to the expected 5,000,007-byte file — PASS.Merge order
This branch is cut from current
main, wherestartLargeFiletakes 6 args. SSE-B2 (#125) adds a 7th*uploadEncryptionarg tostartLargeFile. If #125 merges first, rebase this branch and add, nilto theComposecall site (one line); otherwise merge this before #125.Closes #128