Support streaming writes against HTTP backends#104
Support streaming writes against HTTP backends#104bbockelm merged 10 commits intoPelicanPlatform:mainfrom
Conversation
|
Hi @whwjiang, Justin asked me to take a look at this. Which I will soon. Until then, let me know if you need any help with the unit testing part. It's proven very useful, but isn't always super easy or intuitive to get running. |
bbockelm
left a comment
There was a problem hiding this comment.
Various small nitpicks. The biggest change would be to determine whether you keep the final flag (and, if not, adjust the error conditions in Open appropriately).
.gitignore
Outdated
| @@ -1 +1,2 @@ | |||
| build/ | |||
| .vscode/ No newline at end of file | |||
There was a problem hiding this comment.
Please do this as a separate logical commit (and add in the EOL).
src/HTTPCommands.cc
Outdated
| } | ||
|
|
||
| bool HTTPRequest::SendHTTPRequest(const std::string &payload) { | ||
| bool HTTPRequest::SendHTTPRequest(const std::string &payload, bool final) { |
There was a problem hiding this comment.
Unclear if the final is needed since libcurl knows how large the request should be. Please give it a try without now that we've got more experience with the branch.
src/HTTPFile.cc
Outdated
| if (m_write && !m_write_offset) { | ||
| HTTPUpload upload(m_hostUrl, m_object, m_log, m_oss->getToken()); | ||
| if (!upload.SendRequest(nullptr)) { | ||
| m_log.Emsg("HTTPFile::Close", |
There was a problem hiding this comment.
Switch to Log here as well.
561c768 to
e1a3ed6
Compare
|
@whwjiang - can you please rebase with the various formatting fixes noted above included? |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bbockelm
left a comment
There was a problem hiding this comment.
We're good! Let's go...
Remaining work:
Previously, writing files to HTTP backends didn't really work. With this addition, we should be able to support a multitude of writes, including:
To achieve the last item, we have a single libcurl operation that we keep alive for the lifetime of the file. That is to say, if XRootD issues something like
open() -> write() -> write() -> ... -> write() -> close(), each of the writes in the chain correspond to a single HTTP PUT call, and the connection to the other side is persisted until the file has been completely sent. This is different from our implementation for S3 PUTs, in which case each "chunk" constitutes its own HTTP PUT request.This work was done as a precursor to supporting Globus backends in Pelican.