Skip to content

Commit

Permalink
Change to mutable layers
Browse files Browse the repository at this point in the history
The layer trait interface was changed to mutable in heroku/libcnb.rs#669
  • Loading branch information
schneems committed May 10, 2024
1 parent d5b002c commit 38b0b81
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions buildpacks/ruby/src/layers/bundle_download_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'a> Layer for BundleDownloadLayer<'a> {
}

fn create(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_path: &Path,
) -> Result<LayerResult<Self::Metadata>, RubyBuildpackError> {
Expand Down Expand Up @@ -106,7 +106,7 @@ impl<'a> Layer for BundleDownloadLayer<'a> {
}

fn existing_layer_strategy(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_data: &LayerData<Self::Metadata>,
) -> Result<ExistingLayerStrategy, RubyBuildpackError> {
Expand Down
7 changes: 4 additions & 3 deletions buildpacks/ruby/src/layers/bundle_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ impl Layer for BundleInstallLayer<'_> {
cache: true,
}
}

/// Runs with gems cache from last execution
fn update(
&self,
&mut self,
context: &BuildContext<Self::Buildpack>,
layer_data: &LayerData<Self::Metadata>,
) -> Result<LayerResult<Self::Metadata>, RubyBuildpackError> {
Expand Down Expand Up @@ -150,7 +151,7 @@ impl Layer for BundleInstallLayer<'_> {

/// Runs when with empty cache
fn create(
&self,
&mut self,
context: &BuildContext<Self::Buildpack>,
layer_path: &Path,
) -> Result<LayerResult<Self::Metadata>, RubyBuildpackError> {
Expand All @@ -172,7 +173,7 @@ impl Layer for BundleInstallLayer<'_> {
/// if a coder updates env vars they won't be set unless update or
/// create is run.
fn existing_layer_strategy(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_data: &LayerData<Self::Metadata>,
) -> Result<ExistingLayerStrategy, RubyBuildpackError> {
Expand Down
8 changes: 4 additions & 4 deletions buildpacks/ruby/src/layers/metrics_agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<'a> Layer for MetricsAgentInstall<'a> {
}

fn create(
&self,
&mut self,
_context: &libcnb::build::BuildContext<Self::Buildpack>,
layer_path: &std::path::Path,
) -> Result<
Expand All @@ -102,7 +102,7 @@ impl<'a> Layer for MetricsAgentInstall<'a> {
}

fn update(
&self,
&mut self,
_context: &libcnb::build::BuildContext<Self::Buildpack>,
layer_data: &libcnb::layer::LayerData<Self::Metadata>,
) -> Result<
Expand All @@ -123,7 +123,7 @@ impl<'a> Layer for MetricsAgentInstall<'a> {
}

fn existing_layer_strategy(
&self,
&mut self,
_context: &libcnb::build::BuildContext<Self::Buildpack>,
layer_data: &libcnb::layer::LayerData<Self::Metadata>,
) -> Result<libcnb::layer::ExistingLayerStrategy, <Self::Buildpack as libcnb::Buildpack>::Error>
Expand All @@ -144,7 +144,7 @@ impl<'a> Layer for MetricsAgentInstall<'a> {
}

fn migrate_incompatible_metadata(
&self,
&mut self,
_context: &libcnb::build::BuildContext<Self::Buildpack>,
_metadata: &GenericMetadata,
) -> Result<
Expand Down
4 changes: 2 additions & 2 deletions buildpacks/ruby/src/layers/ruby_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<'a> Layer for RubyInstallLayer<'a> {
}

fn create(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_path: &Path,
) -> Result<LayerResult<Self::Metadata>, RubyBuildpackError> {
Expand All @@ -76,7 +76,7 @@ impl<'a> Layer for RubyInstallLayer<'a> {
}

fn existing_layer_strategy(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_data: &LayerData<Self::Metadata>,
) -> Result<ExistingLayerStrategy, RubyBuildpackError> {
Expand Down
4 changes: 2 additions & 2 deletions commons/src/cache/in_app_dir_cache_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
}

fn create(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
_layer_path: &Path,
) -> Result<LayerResult<Self::Metadata>, B::Error> {
Expand All @@ -68,7 +68,7 @@ where
}

fn existing_layer_strategy(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
layer_data: &LayerData<Self::Metadata>,
) -> Result<ExistingLayerStrategy, B::Error> {
Expand Down
2 changes: 1 addition & 1 deletion commons/src/layer/configure_env_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ where
}

fn create(
&self,
&mut self,
_context: &BuildContext<Self::Buildpack>,
_layer_path: &Path,
) -> Result<LayerResult<Self::Metadata>, B::Error> {
Expand Down

0 comments on commit 38b0b81

Please sign in to comment.