Skip to content
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

Add the URLFor optional method to the storagedriver api #51

Merged

Conversation

AndreyKostov
Copy link
Contributor

This implements part of proposal #49

We now also have a storagedriver error variable for identifying
api calls that are not implemented by drivers (the URLFor method
is not implemented by either the filesystem or inmemory drivers)
return "", storagedriver.InvalidPathError{Path: path}
}

return d.Bucket.SignedURL(d.s3Path(path), time.Now().Add(24*time.Hour)), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever reason the old registry created S3 URLs which were valid for 20 minutes (reference). I'm not sure what the recommended time frame should be, but I feel like 1 day is probably excessive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let the TTL be configurable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add that as an argument to URLFor(), but certain drivers will ignore the TTL. As long as we define the semantic properly and stick with it then it's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we are agreed on adding it as an argument to the URLFor?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that to the discussion over at #49. Leave it out for now, and we can add it when a decision is made.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've suggested the URLFor rpc call take an options argument on #49 .

@BrianBland
Copy link
Contributor

Looks good overall, but we'll wait for some more review of #49.

@@ -265,6 +265,12 @@ func (d *Driver) Delete(subPath string) error {
return err
}

// URLFor returns a URL which may be used to retrieve the content stored at the given path.
// May return an UnsupportedMethodErr in certain StorageDriver implementations.
func (d *Driver) URLFor(path string) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am starting to think we need a default implementation of the storage driver, with method stubs and simple implementations for URLFor, PutContent, GetContent and Move. Implementors can embed and replace as the driver dictates.

@stevvooe stevvooe added this to the Registry/Beta milestone Jan 8, 2015
@stevvooe
Copy link
Collaborator

stevvooe commented Jan 8, 2015

This is looking good. Is there some documentation that needs updating with this addition?

@BrianBland
Copy link
Contributor

@stevvooe No, this should be self-contained. I suggest we merge this PR as-is and I'll tweak the method definition in my fix for #49.

I like the idea of a default driver though. Let's create an issue for that.

@stevvooe
Copy link
Collaborator

stevvooe commented Jan 8, 2015

Ok, LGTM!

stevvooe added a commit that referenced this pull request Jan 8, 2015
Add the URLFor optional method to the storagedriver api
@stevvooe stevvooe merged commit 6586380 into distribution:master Jan 8, 2015
@stevvooe stevvooe modified the milestones: Registry/2.0.0-beta, Registry/2.0 Mar 31, 2015
wahabmk pushed a commit to wahabmk/distribution that referenced this pull request Apr 5, 2022
…e-errors

[ENGDTR-2139] Add Enforcement Policy specific errors to manifest handler
bshaaban pushed a commit to bshaaban/distribution that referenced this pull request Jul 20, 2022
…e-errors

[ENGDTR-2139] Add Enforcement Policy specific errors to manifest handler
bshaaban pushed a commit to bshaaban/distribution that referenced this pull request Jul 27, 2022
…e-errors

[ENGDTR-2139] Add Enforcement Policy specific errors to manifest handler
bshaaban pushed a commit to bshaaban/distribution that referenced this pull request Jul 29, 2022
…e-errors

[ENGDTR-2139] Add Enforcement Policy specific errors to manifest handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants