Commit Graph

29 Commits

Author SHA1 Message Date
zhangyue
12a14c4424 fix: polish log to make more clear
Signed-off-by: zhangyue <zy675793960@yeah.net>
2019-06-20 20:46:26 +08:00
msg555
ee902afa5f Compute manifest metadata when not provided.
This closes #3238

Signed-off-by: msg555 <msg555@gmail.com>
2019-05-01 00:53:16 -04:00
Derek McGowan
26506e9e23
Update empty layer label
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-10-15 11:28:45 -07:00
Wei Fu
57d79e1b49 bugfix: cache empty layer for docker schema1 image
containerd should cache empty label for docker schema1 image.

if not, the original empty layer will be non-empty layer and the image
config will be changed too. in this case, the image ID will be changed.

check the blob empty label to avoid changing image ID when repull docker
schema1 image.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-09-28 15:45:59 +08:00
Wei Fu
9db21deb5d bugfix: avoid to re-calculate blob state for schema1
Use containerd.io/uncompressed label to avoid to re-calculate blob
diffID.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-09-06 09:14:56 +08:00
frank yang
046536cfb1 fixbug: blob for schemav1 could be uncompressed
Signed-off-by: frank yang <yyb196@gmail.com>
2018-06-08 11:50:54 +08:00
Akihiro Suda
703c25e452 fix schema1 fetchBlob()
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-06-07 17:51:41 +09:00
Akihiro Suda
d88de4a34f content: change Writer/ReaderAt to take OCI
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 <suda.akihiro@lab.ntt.co.jp>
2018-06-01 11:51:43 +09:00
Derek McGowan
5304ef294b
Add writer open helper to handle unavailable refs
Updates blob writer helper to use new open and ensure
unavailable errors are always handled.
Removes duplication of unavailable handling code.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-03-21 16:30:22 -07:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Edgar Lee
d2f073c6f5
Add converter options to convert schema1 manifest to docker schema2 manifest
Signed-off-by: Edgar Lee <edgar.lee@docker.com>
2018-01-31 17:13:12 -08:00
Michael Crosby
d179c61231 Revert "Use jsoniteer for faster json encoding/decoding"
This reverts commit 4233b87b89.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-29 15:47:48 -05:00
Michael Crosby
4233b87b89 Use jsoniteer for faster json encoding/decoding
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-26 16:32:55 -05:00
Derek McGowan
b674c64827
Support unknown size from schema 1 manifests
Schema1 manifests did not set a size in the digest for the blobs,
breaking the expectations of the update http seeking reader. Now
the http seeker has been updated to support unknown size as a
value of negative 1 and the schema1 puller sets the unknown size
accordingly.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-21 15:45:09 -08:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Derek McGowan
dce27d8c62
Remove client use of gc root label
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-07 12:54:22 -08:00
Stephen J Day
8eee47cf82
remotes/docker/schema1: back off on locked ref
To allow concurrent pull of images of the v1 persuasion, we need to
backoff when multiple pullers are trying to operate on the same
resource. The back off logic is ported to v1 pull to match the behavior
for other images.

A little randomness is also added to the backoff to prevent thundering
herd and to reduce expected recovery time.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-10-30 15:40:54 -07:00
Michael Crosby
5a386446e3 Merge pull request #1653 from dmcgowan/fix-pull-race
gc: fix pull race
2017-10-18 10:10:32 -04:00
Derek McGowan
b798d87bd4
Ensure manifests are marked as root during pull
For schema1 mark blobs as roots and remove labels
once referenced by the created manifest.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-17 16:26:52 -07:00
Brian Goff
6eb56a2ec9 Use limited reader for some ReadAll cases.
Prevents a server from sending a large response causing containerd to
allocate too much RAM and potentially OOM.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-10-17 09:06:16 -04:00
Michael Crosby
451421b615 Comment more packages to pass go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 13:54:56 -04:00
Derek McGowan
9613acb2ed
Add context to content commit
Content commit is updated to take in a context, allowing
content to be committed within the same context the writer
was in. This is useful when commit may be able to use more
context to complete the action rather than creating its own.
An example of this being useful is for the metadata implementation
of content, having a context allows tests to fully create
content in one database transaction by making use of the context.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-09-06 10:19:12 -07:00
Stephen J Day
8be340e37b
content: remove Provider.Reader
After some analysis, it was found that Content.Reader was generally
redudant to an io.ReaderAt. This change removes `Content.Reader` in
favor of a `Content.ReaderAt`. In general, `ReaderAt` can perform better
over interfaces with indeterminant latency because it avoids remote
state for reads. Where a reader is required, a helper is provided to
convert it into an `io.SectionReader`.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-08-09 14:32:28 -07:00
Kenfe-Mickael Laventure
829845d268
Fix ineffassign warnings
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-03 08:27:15 -07:00
fate-grand-order
d3d1987fe0 correct some misspellings to make Go Report more happy
Signed-off-by: Helen <chenjg@harmonycloud.cn>
2017-07-19 17:31:14 +08:00
Stephen J Day
a4fadc596b
errdefs: centralize error handling
Now that we have most of the services required for use with containerd,
it was found that common patterns were used throughout services. By
defining a central `errdefs` package, we ensure that services will map
errors to and from grpc consistently and cleanly. One can decorate an
error with as much context as necessary, using `pkg/errors` and still
have the error mapped correctly via grpc.

We make a few sacrifices. At this point, the common errors we use across
the repository all map directly to grpc error codes. While this seems
positively crazy, it actually works out quite well. The error conditions
that were specific weren't super necessary and the ones that were
necessary now simply have better context information. We lose the
ability to add new codes, but this constraint may not be a bad thing.

Effectively, as long as one uses the errors defined in `errdefs`, the
error class will be mapped correctly across the grpc boundary and
everything will be good. If you don't use those definitions, the error
maps to "unknown" and the error message is preserved.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-29 15:00:47 -07:00
Derek McGowan
8ed1e24ae9
Add blob state calculation to handle empty ambiguity
The size and throwaway fields in the history can bother be
omitted, making the emptiness of a layer ambiguous. In these
cases download and check whether the content is empty.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-14 11:53:52 -07:00
Derek McGowan
3a226ef17d
Update logic to determine if layer is empty
Handle reliance on the size field when the throwaway field is not used.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-14 10:07:40 -07:00
Derek McGowan
9f90d8a9b4
Add schema1 conversion on pull
closes #851

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-14 10:07:39 -07:00