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

oras pull with cache #203

Merged
merged 6 commits into from
Dec 12, 2020
Merged

oras pull with cache #203

merged 6 commits into from
Dec 12, 2020

Conversation

shizhMSFT
Copy link
Contributor

@shizhMSFT shizhMSFT commented Dec 7, 2020

Resolves #193. The cache is enabled only when the environment variable ORAS_CACHE is set in the CLI.

Example usage:

# Set cache root
export ORAS_CACHE=~/.oras/cache

# Pull artifacts as usual
oras pull localhost:5000/hello:latest

@sajayantony
Copy link
Contributor

Could you please show the layout of the cache?

@shizhMSFT
Copy link
Contributor Author

@sajayantony The cache uses github.com/containerd/containerd/content/local as its content store.

The layout of the cache is

$ORAS_CACHE
├── blobs
│   └── <algorithm>
│       └── <digest>
└── ingest
    └── <ref_digest>
        ├── data
        ├── ref
        ├── startedat
        ├── total
        └── updatedat

Note that the ingest folder is used only when downloading. After downloading, the ingest folder should be empty.

Copy link
Contributor

@jdolitsky jdolitsky left a comment

Choose a reason for hiding this comment

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

Hey, this is great. Does it make sense to include index.json (as in OCI Layout?)

We have OCIStore to manage this file: https://github.com/deislabs/oras/blob/main/pkg/content/oci.go

Can we combine that with the containerd/local cache?

@shizhMSFT
Copy link
Contributor Author

@jdolitsky The cache store here must be a pure content-addressable storage (i.e. no refs) so that the cache can be used by multiple oras clients concurrently with no race conditions.

Besides, we are actually caching at the blob level not images. Therefore, it does not make sense to add an index.

@SteveLasker
Copy link
Contributor

Josh, are you asking if we can store the manifests? Both image-index and image-manifest, so they are cached and available to compute digests?

@jdolitsky
Copy link
Contributor

I'm thinking of Helm here. Had this type of cache (combined with index.json support) had existed, we would not have needed to implemented.. I understand an "oras" pull of reference when working with files does not require saving of the reference (e.g. localhost:5000/hello:latest).

This has value as general purpose local CAS, will approve. Later if needed we can make a hybrid store from this and OCIStore. @shizhMSFT merge when ready

@shizhMSFT shizhMSFT merged commit 9a978bb into main Dec 12, 2020
@shizhMSFT shizhMSFT deleted the shizh/193_cache branch December 12, 2020 06:45
LucianBuzzo added a commit to LucianBuzzo/oras that referenced this pull request May 5, 2021
This change adds simple documentation for the cache functionality added in oras-project#203
jdolitsky pushed a commit that referenced this pull request May 5, 2021
This change adds simple documentation for the cache functionality added in #203
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.

Cached ORAS Pull
4 participants