Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 11, 2024
1 parent 39504b8 commit 8c97844
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/next-api/src/versioned_content_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ pub struct OutputAssetsOperation(Vc<OutputAssets>);
struct MapEntry {
assets_operation: Vc<OutputAssets>,
side_effects: Vc<Completion>,
/// Precomputed map for quick access to output asset by filepath
path_to_asset: HashMap<Vc<FileSystemPath>, Vc<Box<dyn OutputAsset>>>,
}

#[turbo_tasks::value(transparent)]
struct OptionMapEntry(Option<MapEntry>);

type PathToOutputOperation = HashMap<Vc<FileSystemPath>, IndexSet<Vc<OutputAssets>>>;
// A precomputed map for quick access to output asset by filepath
type OutputOperationToComputeEntry = HashMap<Vc<OutputAssets>, Vc<OptionMapEntry>>;

#[turbo_tasks::value]
Expand Down Expand Up @@ -67,6 +69,7 @@ impl VersionedContentMap {
#[turbo_tasks::function]
pub async fn insert_output_assets(
self: Vc<Self>,
// Output assets to emit
assets_operation: Vc<OutputAssetsOperation>,
node_root: Vc<FileSystemPath>,
client_relative_path: Vc<FileSystemPath>,
Expand All @@ -88,6 +91,8 @@ impl VersionedContentMap {
Ok(entry.side_effects)
}

/// Creates a ComputEntry (a pre-computed map for optimized lookup) for an output assets
/// operation. When assets change, map_path_to_op is updated.
#[turbo_tasks::function]
async fn compute_entry(
self: Vc<Self>,
Expand Down

0 comments on commit 8c97844

Please sign in to comment.