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 "get metarange", "get range" API endpoints #1465

Merged
merged 5 commits into from
Feb 17, 2021

Conversation

arielshaqed
Copy link
Contributor

Returns data (currently just the address of the object) by ID.

@arielshaqed arielshaqed requested review from nopcoder and ozkatz and removed request for nopcoder and ozkatz February 16, 2021 07:42
@codecov-io
Copy link

codecov-io commented Feb 16, 2021

Codecov Report

Merging #1465 (1873a4c) into master (7d63bc5) will decrease coverage by 0.21%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
api/controller.go 35.85% <0.00%> (-0.69%) ⬇️
catalog/entry_catalog.go 12.88% <0.00%> (-0.08%) ⬇️
catalog/rocks_cataloger.go 24.11% <0.00%> (-0.12%) ⬇️
graveler/committed/manager.go 0.00% <0.00%> (ø)
graveler/committed/meta_range_manager.go 0.00% <0.00%> (ø)
graveler/committed/range.go 87.50% <ø> (ø)
graveler/committed/range_manager.go 100.00% <ø> (ø)
graveler/graveler.go 30.51% <0.00%> (-0.34%) ⬇️
graveler/sstable/range_manager.go 30.88% <0.00%> (-0.47%) ⬇️
pyramid/tier_fs.go 56.76% <0.00%> (-2.01%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d63bc5...e996175. Read the comment docs.

@arielshaqed arielshaqed force-pushed the feature/add-metadata-location-endpoint branch from e19b271 to 4cf999d Compare February 16, 2021 08:00
Copy link
Contributor

@nopcoder nopcoder left a 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.
Copy link
Contributor

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

Copy link
Contributor Author

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...).

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.
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

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.
Copy link
Contributor

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

swagger.yml Show resolved Hide resolved
Copy link
Contributor Author

@arielshaqed arielshaqed left a 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".

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.
Copy link
Contributor Author

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.
Copy link
Contributor Author

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...).

swagger.yml Show resolved Hide resolved
@arielshaqed arielshaqed requested a review from ozkatz February 17, 2021 09:47
@arielshaqed
Copy link
Contributor Author

  • @ozkatz to look at permissions for these actions, please.

Copy link
Contributor Author

@arielshaqed arielshaqed left a 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.

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.
Copy link
Contributor Author

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.

@arielshaqed arielshaqed force-pushed the feature/add-metadata-location-endpoint branch from edd394c to e996175 Compare February 17, 2021 10:59
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.
@arielshaqed arielshaqed force-pushed the feature/add-metadata-location-endpoint branch from e996175 to f581e49 Compare February 17, 2021 11:14
@arielshaqed arielshaqed merged commit f2ed086 into master Feb 17, 2021
@arielshaqed arielshaqed deleted the feature/add-metadata-location-endpoint branch February 17, 2021 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add endpoint to fetch locations of ranges and metaranges on backing store
3 participants