zot icon indicating copy to clipboard operation
zot copied to clipboard

s3: add a 'redirect' flag in storageDriver params and based on it serve blobs or redirect to S3 URLs

Open eusebiu-constantin-petu-dbk opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. When using s3 as backend storage zot first downloads blobs from s3 and then serves them thus wasting time. It should be able to use redirects to s3 urls based on a 'redirect' flag in storageDriver config parameters.

Describe the solution you'd like

If redirect flag is true then:

  1. use path := storage.BlobPath() to get path to blob
  2. use url := storageDriver.URLFor(path)
  3. in routes use http.Redirect(url) and serve the URLs instead of blobs.

we can add a new func to Storage interface URLForPath(path) that calls storageDriver.URLFor(path) for filesystem storage return a err.NotImplemented.