-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(handler, s3store): implement ServerDataStore for direct content serving #1208
base: main
Are you sure you want to change the base?
Conversation
Please note I tried to avoid changing the go version, but This is a draft to get feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for working on this! I left a few comments but the direction where this is heading is looking good.
6e09111
to
d9e8bca
Compare
@Acconut changes have been made. kudos. |
@@ -121,6 +122,16 @@ type DataStore interface { | |||
GetUpload(ctx context.Context, id string) (upload Upload, err error) | |||
} | |||
|
|||
// ServableUpload defines the method for serving content directly | |||
type ServableUpload interface { | |||
ServeContent(ctx context.Context, w http.ResponseWriter, r *http.Request) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function needs proper documentation. That's best done when we have agreed on what the handler does and does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmk what/when you want docs on this.
// If the data store implements ContentServerDataStore, use the ServableUpload interface | ||
if handler.composer.UsesContentServer { | ||
servableUpload := handler.composer.ContentServer.AsServableUpload(upload) | ||
err = servableUpload.ServeContent(c, w, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the handler should set the Content-Length, Content-Type and Content-Disposition before passing it to ServeContent
. The implementation can then decide to overwrite or keep them. The idea is that we already have logic for extracting the filename and filetype from metadata and this way we can keep using them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you decide?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates! This is moving in the right direction and I feel like we're getting close :)
d9e8bca
to
259cd68
Compare
…ontent serving, closes tus#1064 - Add ServerDataStore interface - Implement ContentServerDataStore in S3Store with streaming support - Add Range header support for partial content requests - Update StoreComposer to support ContentServer capability - Add tests for new ContentServerDataStore functionality - Update Go version to 1.22.1
259cd68
to
79384ce
Compare
@Acconut changes have been made. |
Closes #1064