2022-05-07 20:08:51 +05:30
|
|
|
package upload
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gitlab.com/gitlab-org/gitlab/workhorse/internal/api"
|
|
|
|
"gitlab.com/gitlab-org/gitlab/workhorse/internal/upload/destination"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Preparer is a pluggable behavior that interprets a Rails API response
|
|
|
|
// and either tells Workhorse how to handle the upload, via the
|
2022-07-16 23:28:13 +05:30
|
|
|
// UploadOpts, or it rejects the request by returning a non-nil error.
|
|
|
|
// Its intended use is to make sure the upload gets stored in the right
|
|
|
|
// location: either a local directory, or one of several supported object
|
|
|
|
// storage backends.
|
2022-05-07 20:08:51 +05:30
|
|
|
type Preparer interface {
|
2022-07-16 23:28:13 +05:30
|
|
|
Prepare(a *api.Response) (*destination.UploadOpts, error)
|
2022-05-07 20:08:51 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
type DefaultPreparer struct{}
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
func (s *DefaultPreparer) Prepare(a *api.Response) (*destination.UploadOpts, error) {
|
|
|
|
return destination.GetOpts(a)
|
2022-05-07 20:08:51 +05:30
|
|
|
}
|