Skip to content

content: change Writer/ReaderAt to take OCI descriptor#2135

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
AkihiroSuda:oci-content-store
Jun 1, 2018
Merged

content: change Writer/ReaderAt to take OCI descriptor#2135
crosbymichael merged 1 commit intocontainerd:masterfrom
AkihiroSuda:oci-content-store

Conversation

@AkihiroSuda
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda commented Feb 15, 2018

This change allows implementations to resolve the location of the actual
data using OCI descriptor fields such as MediaType.

No OCI descriptor field is written to the store.

No change on gRPC API.

contrib/registrycontentstore is added as an example usecase of this. (EDIT: will be a separate PR)

Signed-off-by: Akihiro Suda [email protected]


Close #2129

@tonistiigi @dmcgowan

Comment thread services/content/service.go Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This PR has no impact on gRPC API but changes this behavior.
I believe the previous behavior was bug.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does size need to be updated in this case then? The section reader uses the reader at interface which may cause a seek to be performed beyond the size.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

split this fix as #2221

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 15, 2018

Codecov Report

Merging #2135 into master will decrease coverage by 3.9%.
The diff coverage is 46.83%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2135      +/-   ##
=========================================
- Coverage   45.11%   41.2%   -3.91%     
=========================================
  Files          92      66      -26     
  Lines        9358    7809    -1549     
=========================================
- Hits         4222    3218    -1004     
+ Misses       4457    4086     -371     
+ Partials      679     505     -174
Flag Coverage Δ
#linux ?
#windows 41.2% <46.83%> (-0.21%) ⬇️
Impacted Files Coverage Δ
content/helpers.go 22.64% <0%> (ø) ⬆️
oci/spec_opts_windows.go 0% <0%> (ø) ⬆️
images/oci/importer.go 5.3% <0%> (ø) ⬆️
images/oci/exporter.go 0% <0%> (ø) ⬆️
content/content.go 0% <0%> (ø) ⬆️
content/local/store.go 51.96% <53.84%> (-0.16%) ⬇️
metadata/content.go 39.53% <66.66%> (+0.11%) ⬆️
snapshots/native/native.go 1.8% <0%> (-42.09%) ⬇️
oci/spec.go 0% <0%> (-40%) ⬇️
archive/tar.go 16.85% <0%> (-26.2%) ⬇️
... and 36 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 e4ad710...d88de4a. Read the comment docs.

@dmcgowan
Copy link
Copy Markdown
Member

Can we split out the registry test and contib into a separate PR and focus on the interface change. Feel free to point at that work for justification.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

Comment thread content/helpers.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should take the descriptor as a parameter instead. All cases that I found where this was called it already took a digest from a descriptor before calling.

Comment thread content/testsuite/mediatype.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not look like a correct assumption as a reader is supposed to track previous reads. Likely doesn't appear atm because tests use small blobs.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

@tonistiigi updated. I changed WriteBlob as well accordingly.

Comment thread content/helpers.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please, no oci descriptor on write.

Comment thread content/local/store_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See this is wrong: the Descriptor is not for passing optional arguments.

@stevvooe
Copy link
Copy Markdown
Member

In general, this is a problematic change. The content store is supposed to be purely content addressed with no understanding of types. The resolver/fetcher layer is the system to use for handling type aware content operations.

@tonistiigi
Copy link
Copy Markdown
Member

tonistiigi commented Feb 26, 2018

The content store is supposed to be purely content addressed with no understanding of types.

That does not change. It doesn't change the store but the interface. Types are not stored and are not part of the interface guarantees. It is just a hint that an implementation can take. Data written with a specific digest will always return back for the same digest. It would be problematic if Provider returns back a type but it doesn't.

The resolver/fetcher layer is the system to use for handling type aware content operations.

That's the problem. There are duplicate stacks implemented atm that can't be used together for a lot of useful use-cases nor extended with new implementations. Code for copying content needs to be specific for the implementations and has a separate set of helper functions. Alternatively, this could be implemented with new fetcher/pusher interfaces that bring them to the same functionality of content.Provider/Writer and then removing all the use cases (I guess apart from that internal testcase use-case that you left a comment on) where the old types are currently being used.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

Closing temporarily, until we can reach consensus on #2129

@AkihiroSuda
Copy link
Copy Markdown
Member Author

reopened PR

@stevvooe @tonistiigi @dmcgowan

Comment thread .travis.yml Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

cc @Random-Liu
Is this correct way?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe the correct way is to update it in a fork and point the vendor to your fork. We should never do a merge into master without validated vendors.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated

Comment thread content/local/store.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we handle the empty ref case now? This looks dangerous with an empty ref and could easily be omitted now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated to require non-empty ref

AkihiroSuda added a commit to AkihiroSuda/cri-containerd that referenced this pull request May 22, 2018
Copy link
Copy Markdown
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

@AkihiroSuda
Copy link
Copy Markdown
Member Author

rebased

@AkihiroSuda
Copy link
Copy Markdown
Member Author

@stevvooe PTAL?

@AkihiroSuda
Copy link
Copy Markdown
Member Author

rebased again

This change allows implementations to resolve the location of the actual data
using OCI descriptor fields such as MediaType.

No OCI descriptor field is written to the store.

No change on gRPC API.

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda
Copy link
Copy Markdown
Member Author

rererebased

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Jun 1, 2018

re-LGTM, let's get this merged because rebasing vendors like that is not fun

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit 5b1f69b into containerd:master Jun 1, 2018
Comment thread vendor.conf
# cri dependencies
github.com/containerd/cri b68fb075d49aa1c2885f45f2467142666c244f4a
# #2135: cri is temporarily forked because of circular dependency. will be fixed immediately in a follow-up PR.
github.com/containerd/cri 6e975823be192ad19f2ce7afcf6c57b88a991c30 https://github.com/AkihiroSuda/cri-containerd.git
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@AkihiroSuda I spotted this one, but couldn't fine an associated PR in https://github.com/containerd/cri - are you working on this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh! never mind; I see that this was just merged; I looked at the commit-date.

AkihiroSuda added a commit to AkihiroSuda/cri-containerd that referenced this pull request Jun 2, 2018
@AkihiroSuda
Copy link
Copy Markdown
Member Author

opened containerd/cri#799

AkihiroSuda added a commit to AkihiroSuda/cri-containerd that referenced this pull request Jun 2, 2018
AkihiroSuda added a commit to AkihiroSuda/cri-containerd that referenced this pull request Jun 2, 2018
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.

[RFC] content: change Writer/ReaderAt to take OCI descriptor

7 participants