Respackopts/src/main/java/io/gitlab/jfronny/respackopts/model/cache/CachedPackState.java

38 lines
1.2 KiB
Java

package io.gitlab.jfronny.respackopts.model.cache;
import io.gitlab.jfronny.muscript.data.Scope;
import io.gitlab.jfronny.muscript.data.Script;
import io.gitlab.jfronny.respackopts.model.*;
import io.gitlab.jfronny.respackopts.model.tree.ConfigBranch;
import io.gitlab.jfronny.respackopts.muscript.MuScriptScope;
import java.util.*;
public record CachedPackState(
String packId,
String displayName,
String packName,
ConfigBranch configBranch,
PackMeta metadata,
Map<String, FileRpo> cachedFileRPOs,
Map<String, List<DirRpo>> cachedDirRPOs, // Directory RPOs, from outermost to innermost
Map<String, Script> cachedScripts, // Scripts, available via runScript
Map<String, String> cachedFiles, // Files, read by readString
Scope executionScope
) {
public CachedPackState(CacheKey key, PackMeta meta, ConfigBranch branch) {
this(
meta.id,
key.displayName(),
key.packName(),
branch,
meta,
new HashMap<>(),
new HashMap<>(),
new HashMap<>(),
new HashMap<>(),
branch.addTo(MuScriptScope.fork(meta.version))
);
}
}