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

Create an API for Pre-processing layers #504

Open
jsturtevant opened this issue Mar 6, 2024 · 0 comments
Open

Create an API for Pre-processing layers #504

jsturtevant opened this issue Mar 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jsturtevant
Copy link
Contributor

jsturtevant commented Mar 6, 2024

We've added the ability to pre-compile layers in #405 and followed up with some improvements in #492.

During the iterations it was identified that a similar API could be used to do other pre-initialization work as well:

  • composing multiple layers into a single layer
  • pre-compiling (as is already done but could be done in this api instead along with other processing)
  • using tools like Wizer to do other pre-initialization optimizations

I would like to propose we create an API similar to the precompile but would replace it with something like process_layers or initialize_layers . This should also allow the shim to give us processed layers that are combined and the id's of ones the want to remain untouched.

One possible way to do this would look something like the precompile layer (open to suggestions):

struct ProcessedLayers {
  layers: Vec<Layer>
  unique_cache_id: Option<String> // return None if nothing to do
}

enum Layer {
 Original(digest)  // for files we want untouched
 Processed(Vec<u8>)
}

fn precompile(&self, _layers: &[WasmLayer]) -> Result<ProcessedLayers> {
        // do work
}

On the shim side we could take the layers create a new file that stores these digests and link it to the original image. Upon reloading the image we could look up the file, load those digests.

Questions:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant