-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ociregistry: split PushBlobChunked in two and add offset to resume
As a method, PushBlobChunked was getting heavy. Depending on whether id was empty, we would start a chunked upload, which in ociclient entails a POST to get a new upload ID, or we would resume a previous chunked upload, which in ociclient entails a GET to get the last offset. For the case where we start a new upload, we now have PushBlobChunked which no longer takes an id and whose behavior is now pretty simple. For the case where we resume a previous upload, we now have PushBlobChunkedResume which does require the previous id. It also takes an offset, so that ociclient need not perform a GET to retrieve the last offset if the user kept track of it. It can be left as -1 to keep the old behavior with a GET. Adding the offset parameter to the resume method is a crucial detail. Right now, implementing an OCI registry proxy by joining a user-facing ociserver with an ociclient pointed at a "backend" registry works. But, since ociserver implements chunked upload PATCH and PUT requests as a chunked upload resumption via ociclient, such a proxy would for example turn POST+PATCH into POST+GET+PATCH. The interface now allows the end user to keep track of the last offset alongside the id of the chunked upload it's doing, meaning that a proxy will soon be capable of avoiding extra GETs. For now, the ociserver code gains two TODOs to make that change, for the sake of making the two changes separately. Finally, I also noticed that ocimem's chunked upload resumption is surprisingly lenient, allowing the previous ID to not exist at all. The tests in ociserver seem to rely on this; I've added a TODO to revisit the matter at some point. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I6d18d00221417a26c29ac5d56a9677d6f018e2c9 Dispatch-Trailer: {"type":"trybot","CL":1170688,"patchset":1,"ref":"refs/changes/88/1170688/1","targetBranch":"main"}
- Loading branch information
1 parent
cbb5014
commit ef8bbf1
Showing
11 changed files
with
242 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.