Skip to content

Commit

Permalink
Stops spk adding annotations when spfs is not using the flatfilebuffe…
Browse files Browse the repository at this point in the history
…rs encoding format.

When flatfilebuffers encoding is enabled, spk will add an annotation to the spfs runtimes it make.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
  • Loading branch information
dcookspi committed Jun 6, 2024
1 parent ee915b9 commit fb88f32
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions crates/spk-exec/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use async_stream::try_stream;
use futures::Stream;
use relative_path::RelativePathBuf;
use spfs::encoding::Digest;
use spfs::graph::object::EncodingFormat;
use spfs::prelude::*;
use spfs::tracking::Entry;
use spk_schema::foundation::format::{FormatIdent, FormatOptionMap};
Expand Down Expand Up @@ -199,18 +200,21 @@ pub async fn setup_runtime(rt: &mut spfs::runtime::Runtime, solution: &Solution)
resolve_runtime_layers(rt.config.mount_backend.requires_localization(), solution).await?;
rt.status.stack = spfs::graph::Stack::from_iter(stack);

// Store additional solve data all the resolved packages as extra
// data in the spfs runtime so future spk commands run inside the
// runtime can access it.
let solve_data = serde_json::to_string(&solution.packages_to_solve_data())
.map_err(|err| Error::String(err.to_string()))?;
let spfs_config = spfs::Config::current()?;
rt.add_annotation(
SPK_SOLVE_EXTRA_DATA_KEY.to_string(),
solve_data,
spfs_config.filesystem.annotation_size_limit,
)
.await?;
// Annotations are only supported with FlatFileBuffers
if spfs_config.storage.encoding_format == EncodingFormat::FlatBuffers {
// Store additional solve data all the resolved packages as extra
// data in the spfs runtime so future spk commands run inside the
// runtime can access it.
let solve_data = serde_json::to_string(&solution.packages_to_solve_data())
.map_err(|err| Error::String(err.to_string()))?;
rt.add_annotation(
SPK_SOLVE_EXTRA_DATA_KEY.to_string(),
solve_data,
spfs_config.filesystem.annotation_size_limit,
)
.await?;
}

rt.save_state_to_storage().await?;
spfs::remount_runtime(rt).await?;
Expand Down

0 comments on commit fb88f32

Please sign in to comment.