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

images, containers: converge metadata API conventions #1151

Merged
merged 1 commit into from Jul 11, 2017

Conversation

stevvooe
Copy link
Member

The primary feature we get with this PR is support for filters and
labels on the image metadata store. In the process of doing this, the
conventions for the API have been converged between containers and
images, providing a model for other services.

With images, Put (renamed to Update briefly) has been split into a
Create and Update, allowing one to control the behavior around these
operations. Update now includes support for masking fields at the
datastore-level across both the containers and image service. Filters
are now just string values to interpreted directly within the data
store. This should allow for some interesting future use cases in which
the datastore might use the syntax for more efficient query paths.

The containers service has been updated to follow these conventions as
closely as possible.

Signed-off-by: Stephen J Day stephen.day@docker.com

@stevvooe stevvooe added this to the containerd alpha milestone Jul 10, 2017
@codecov-io
Copy link

codecov-io commented Jul 10, 2017

Codecov Report

Merging #1151 into master will decrease coverage by 0.1%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1151      +/-   ##
==========================================
- Coverage   31.88%   31.78%   -0.11%     
==========================================
  Files          27       27              
  Lines        2161     2168       +7     
==========================================
  Hits          689      689              
- Misses       1324     1331       +7     
  Partials      148      148
Impacted Files Coverage Δ
client.go 2.6% <0%> (-0.07%) ⬇️

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 54e2b9d...7f4c4ae. Read the comment docs.

Copy link
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

just a few nits.

LGTM

@@ -26,6 +28,11 @@ service Images {
// List returns a list of all images known to containerd.
rpc List(ListImagesRequest) returns (ListImagesResponse);

// Create an image reocrd in the metadata store.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/reocrd/record/

}
sort.Strings(labelPairs)
labels := "-"
if len(labelPairs) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

the loop around image.Labels to fill up labelPairs and the sort on the result can be moved under a if len(image.Labels) > 0

fieldpaths = append(fieldpaths, strings.Join([]string{"labels", k}, "."))
}

fmt.Println("send labels", labels)
Copy link
Contributor

Choose a reason for hiding this comment

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

forgotten debug line?

// ParseAll parses each filter in ss and returns a filter that will return true
// if any filter matches the expression.
//
// If not fitlers are provided, the filter will match anything.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/not fitlers/ no filters/

@@ -13,14 +14,21 @@ import (

// Image provides the model for how containerd views container images.
type Image struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we use the api type here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to do that in a separate change. That is my current TODO item.

The primary feature we get with this PR is support for filters and
labels on the image metadata store. In the process of doing this, the
conventions for the API have been converged between containers and
images, providing a model for other services.

With images, `Put` (renamed to `Update` briefly) has been split into a
`Create` and `Update`, allowing one to control the behavior around these
operations. `Update` now includes support for masking fields at the
datastore-level across both the containers and image service. Filters
are now just string values to interpreted directly within the data
store. This should allow for some interesting future use cases in which
the datastore might use the syntax for more efficient query paths.

The containers service has been updated to follow these conventions as
closely as possible.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
@stevvooe
Copy link
Member Author

@mlaventure Thanks for the review!

@crosbymichael
Copy link
Member

LGTM

}
}
} else {
updated = image
Copy link
Member

Choose a reason for hiding this comment

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

Should we really just completely override here or should we be stricter about immutable data. The only field which would apply here is created at. Allowing that field to be updated I think will lead to more accidental override rather than filling in use cases where it is intentionally overridden.

updated = image
}

// TODO(stevvooe): Should only mark as updated if we have actual changes.
Copy link
Member

Choose a reason for hiding this comment

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

My thought, no we should update the timestamp anytime this function is called. Similar to touching a file, it should be possible to update a timestamp without updating the values.

@dmcgowan
Copy link
Member

dmcgowan commented Jul 11, 2017

LGTM

Going to merge this one now, I would still like to discuss updated = image and that pattern in general, but this should get merged so I can base the content work on it.

@dmcgowan dmcgowan merged commit 106c750 into containerd:master Jul 11, 2017
ianlewis pushed a commit to ianlewis/containerd that referenced this pull request Dec 8, 2020
…bility

Initial support for traffic shaping
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.

None yet

5 participants