-
Notifications
You must be signed in to change notification settings - Fork 879
NG: Need to clarify commit of writes in StorageDriver interface #814
Comments
@stevvooe WritePartial/WriteCommit will have almost the same functionality, right? (i.e. how will the filesystem implementations of these methods would look like?) The notion of non-atomicity comes in the case of On the other hand, having About the |
@ahmetalpbalkan You hit the nail on the head. The size parameter existed mostly because it was necessary for the s3 driver (and potentially other drivers in the future). The issue (as was stated) was that some drivers will require to explicitly be told when an upload is "done". Azure is not one of them, hence you did not need to make use of the size parameter (the purpose of which was to say, if you've written a total of size bytes, you're done). That said, you are correct that it is not the cleanest way imaginable to handle the issue from an API perspective. I suggest that we go with 2) and Refactor the api into:
Under this version, for the Azure driver WriteCommit is a nop. The only question is whether we also need to actually pass the size to WriteCommit, but this won't be |
@AndreyKostov LGTM! Let's just clarify that the return value |
@AndreyKostov sounds good. However I'm not sure how "nn" will be used. WriteStream should be writing whatever it gets until EOF from reader. I see that Go io.Writer.Write returns nn; however, in this case partial writes should be returning error. If we require nn, it will be in favor of filesystem writer and other drivers will need to calculate the stream size to return the correct value. |
@ahmetalpbalkan The return value |
@ahmetalpbalkan I realized that I only addressed half of your question: the |
It turns out we don't need any of this for the s3 driver implementation. To make the |
@BrianBland This is great to hear. We'll hold off on the addition of adding a I'll close out this ticket completely where we hear back from @ahmetalpbalkan on the azure driver. |
Yeah, we'll have to fork goamz to add support for this s3 api call, but
|
@stevvooe I agree with @AndreyKostov's comment about how the azure driver would look like in this case. Are you asking about anything specific? |
@ahmetalpbalkan Checkout @BrianBland's comment. Basically, it's more effective to commit with each write, then use UploadPartCopy for s3, eliding the need for the Commit/Complete/Sync. If you could weigh in on the azure blob API, we can close this ticket and not implement the extra storage driver call. |
As far as I can recall, we've worked out most of the issues with the driver API. If there are still problems, let's open up a new issue in docker/distribution referring back to this issue. |
Right now, the commit for chunks headed to backends like s3 and azure is unhandled. We need a solution such that multiple calls to
WriteStream
followed by some action correctly commit multipart uploads.The original approach was to pass the total size to
WriteStream
, as a size argument. Unfortunately, this can be easily confused with the size of the chunk provided by the reader (a mistake that I have clearly made, even after getting clarification 😞). Issue #781 proposes to completely remove the confusing argument. The V2 api also defers the posting of the actual size to the API to the last chunk, making the use of thesize
argument as the completion sigil problematic.There are a few options:
size
argument and clearly document that its the "total size" of the uploading content. Ifsize
is negative, leave the upload open so one only needs to pass it in the last chunk.WriteStream(path string, offset int64, reader io.Reader) (nn int64, err error)
intoWritePartial(path string, offset int64, reader io.Reader) (nn int64, err error)
andWriteCommit(path string, offset int64, reader io.Reader) (nn int64, err error)
.LayerUpload
. This avoids the entire notion of a VFS and standardizes on a common interface but defers a lot of behavior to the backend. It does have the benefit that the storage layout can be optimized for the particular backend.The ongoing API changes are in the branch below, for reference:
https://github.com/stevvooe/docker-registry/tree/ng-storagedriver-updates
This branch will be PR'd sometime today, but I'd like for us to figure out this situation ASAP.
@BrianBland @AndreyKostov @ahmetalpbalkan @dmp42
The text was updated successfully, but these errors were encountered: