-
Notifications
You must be signed in to change notification settings - Fork 362
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 "get metarange", "get range" API endpoints #1465
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1465 +/- ##
==========================================
- Coverage 39.37% 39.15% -0.22%
==========================================
Files 161 161
Lines 12893 12956 +63
==========================================
- Hits 5076 5073 -3
- Misses 7086 7151 +65
- Partials 731 732 +1
Continue to review full report at Codecov.
|
e19b271
to
4cf999d
Compare
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.
Looks great, with minor comments/suggestions and a question down at the end before you commit.
type Plumbing interface { | ||
// GetMetarange returns information where metarangeID is stored. | ||
GetMetaRange(ctx context.Context, repositoryID RepositoryID, metaRangeID MetaRangeID) (MetaRangeData, error) | ||
// GetRange returns information where rangeID is stored. |
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.
Consider calling it xxxStats returning xxxInfo
ex: MetaRangeStat -> MetaRangeInfo
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.
Not sure I understand the first part, it's not a "stat". But happy to change "Data" to "Info" (it's pretty much to avoid having another "MetaRange" type...).
api/controller.go
Outdated
return metadata.GetMetaRangeHandlerFunc(func(params metadata.GetMetaRangeParams, user *models.User) middleware.Responder { | ||
deps, err := c.setupRequest(user, params.HTTPRequest, []permissions.Permission{ | ||
{ | ||
// TODO(oz): May want tighter permissions here. |
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.
Remember to remove the todo after verifying
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.
@ozkatz are we good with these?
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.
After f2fing, changed to require both list objects and read repo: it gives a cross between the 2. E.g. with (just) read permission on underlying storage it gives list objects (and without it gives size of branch), which is list-objects-like. But it also gives the storage namespace for the repo, which is read-repo-like. So best to require both.
api/controller.go
Outdated
return metadata.GetRangeHandlerFunc(func(params metadata.GetRangeParams, user *models.User) middleware.Responder { | ||
deps, err := c.setupRequest(user, params.HTTPRequest, []permissions.Permission{ | ||
{ | ||
// TODO(oz): May want tighter permissions here. |
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.
Remember to remove the todo after verifying
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.
Thanks!
Keeping the Location header, changing the names from "...Data" to "...Info".
api/controller.go
Outdated
return metadata.GetMetaRangeHandlerFunc(func(params metadata.GetMetaRangeParams, user *models.User) middleware.Responder { | ||
deps, err := c.setupRequest(user, params.HTTPRequest, []permissions.Permission{ | ||
{ | ||
// TODO(oz): May want tighter permissions here. |
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.
@ozkatz are we good with these?
type Plumbing interface { | ||
// GetMetarange returns information where metarangeID is stored. | ||
GetMetaRange(ctx context.Context, repositoryID RepositoryID, metaRangeID MetaRangeID) (MetaRangeData, error) | ||
// GetRange returns information where rangeID is stored. |
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.
Not sure I understand the first part, it's not a "stat". But happy to change "Data" to "Info" (it's pretty much to avoid having another "MetaRange" type...).
|
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.
Thanks!
Pulling once the tests settle.
api/controller.go
Outdated
return metadata.GetMetaRangeHandlerFunc(func(params metadata.GetMetaRangeParams, user *models.User) middleware.Responder { | ||
deps, err := c.setupRequest(user, params.HTTPRequest, []permissions.Permission{ | ||
{ | ||
// TODO(oz): May want tighter permissions here. |
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.
After f2fing, changed to require both list objects and read repo: it gives a cross between the 2. E.g. with (just) read permission on underlying storage it gives list objects (and without it gives size of branch), which is list-objects-like. But it also gives the storage namespace for the repo, which is read-repo-like. So best to require both.
edd394c
to
e996175
Compare
Returns data (currently just the address of the object) by ID.
It really is a cross between "read repo" (which lets you see namespace on underlying storage) and "list objects" (which you will get, once you read all the files). So require both.
e996175
to
f581e49
Compare
Update The Other swagger.yml.
Returns data (currently just the address of the object) by ID.