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

feat(ext/cache): support lscache #27628

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ node_resolver = { version = "0.24.0", path = "./resolvers/node" }

aes = "=0.8.3"
anyhow = "1.0.57"
async-stream = "0.3"
async-trait = "0.1.73"
base32 = "=0.5.1"
base64 = "0.21.7"
Expand Down
8 changes: 8 additions & 0 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ pub struct Flags {
pub code_cache_enabled: bool,
pub permissions: PermissionFlags,
pub allow_scripts: PackagesAllowedScripts,
pub internal_use_lsc_cache: bool,
}

#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -3764,6 +3765,12 @@ fn runtime_misc_args(app: Command) -> Command {
.arg(seed_arg())
.arg(enable_testing_features_arg())
.arg(strace_ops_arg())
.arg(
Arg::new("internal-use-lsc-cache")
.long("internal-use-lsc-cache")
.action(ArgAction::SetTrue)
.hide(true),
)
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved
}

fn allow_import_arg() -> Arg {
Expand Down Expand Up @@ -5634,6 +5641,7 @@ fn runtime_args_parse(
allow_scripts_arg_parse(flags, matches)?;
}
location_arg_parse(flags, matches);
flags.internal_use_lsc_cache = matches.get_flag("internal-use-lsc-cache");
v8_flags_arg_parse(flags, matches);
seed_arg_parse(flags, matches);
enable_testing_features_arg_parse(flags, matches);
Expand Down
4 changes: 4 additions & 0 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,10 @@ impl CliOptions {
&self.flags.v8_flags
}

pub fn use_lsc_cache(&self) -> bool {
self.flags.internal_use_lsc_cache
}

pub fn code_cache_enabled(&self) -> bool {
self.flags.code_cache_enabled
}
Expand Down
1 change: 1 addition & 0 deletions cli/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ impl CliFactory {
pkg_json_resolver,
self.root_cert_store_provider().clone(),
cli_options.resolve_storage_key_resolver(),
cli_options.use_lsc_cache(),
self.sys(),
self.create_lib_main_worker_options()?,
);
Expand Down
5 changes: 5 additions & 0 deletions cli/lib/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ struct LibWorkerFactorySharedState<TSys: DenoLibSys> {
root_cert_store_provider: Arc<dyn RootCertStoreProvider>,
shared_array_buffer_store: SharedArrayBufferStore,
storage_key_resolver: StorageKeyResolver,
use_lsc_cache: bool,
sys: TSys,
options: LibMainWorkerOptions,
}
Expand Down Expand Up @@ -326,6 +327,7 @@ impl<TSys: DenoLibSys> LibWorkerFactorySharedState<TSys> {
worker_type: args.worker_type,
stdio: stdio.clone(),
cache_storage_dir,
use_lsc_cache: shared.use_lsc_cache,
strace_ops: shared.options.strace_ops.clone(),
close_on_idle: args.close_on_idle,
maybe_worker_metadata: args.maybe_worker_metadata,
Expand Down Expand Up @@ -357,6 +359,7 @@ impl<TSys: DenoLibSys> LibMainWorkerFactory<TSys> {
pkg_json_resolver: Arc<node_resolver::PackageJsonResolver<TSys>>,
root_cert_store_provider: Arc<dyn RootCertStoreProvider>,
storage_key_resolver: StorageKeyResolver,
use_lsc_cache: bool,
sys: TSys,
options: LibMainWorkerOptions,
) -> Self {
Expand All @@ -376,6 +379,7 @@ impl<TSys: DenoLibSys> LibMainWorkerFactory<TSys> {
root_cert_store_provider,
shared_array_buffer_store: Default::default(),
storage_key_resolver,
use_lsc_cache,
sys,
options,
}),
Expand Down Expand Up @@ -500,6 +504,7 @@ impl<TSys: DenoLibSys> LibMainWorkerFactory<TSys> {
should_wait_for_inspector_session: shared.options.inspect_wait,
strace_ops: shared.options.strace_ops.clone(),
cache_storage_dir,
use_lsc_cache: shared.use_lsc_cache,
origin_storage_dir,
stdio,
skip_op_registration: shared.options.skip_op_registration,
Expand Down
1 change: 1 addition & 0 deletions cli/rt/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ pub async fn run(
pkg_json_resolver,
root_cert_store_provider,
StorageKeyResolver::empty(),
false,
sys.clone(),
lib_main_worker_options,
);
Expand Down
11 changes: 11 additions & 0 deletions ext/cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@ description = "Implementation of Cache API for Deno"
path = "lib.rs"

[dependencies]
anyhow.workspace = true
async-stream.workspace = true
async-trait.workspace = true
base64.workspace = true
bytes.workspace = true
chrono.workspace = true
deno_core.workspace = true
deno_error.workspace = true
futures.workspace = true
http.workspace = true
hyper.workspace = true
reqwest.workspace = true
rusqlite.workspace = true
serde.workspace = true
sha2.workspace = true
slab.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-util.workspace = true
Loading
Loading