diff --git a/cli/args/flags.rs b/cli/args/flags.rs index cfa2dbb270..f86aa50186 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -627,7 +627,6 @@ 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)] @@ -3765,12 +3764,6 @@ 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), - ) } fn allow_import_arg() -> Arg { @@ -5641,7 +5634,6 @@ 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); diff --git a/cli/args/mod.rs b/cli/args/mod.rs index d80089e26a..e4f332a8bc 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1662,10 +1662,6 @@ 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 } diff --git a/cli/factory.rs b/cli/factory.rs index 09813b301b..91c5d07b75 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -1131,7 +1131,6 @@ 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()?, ); diff --git a/cli/lib/worker.rs b/cli/lib/worker.rs index 112b3a37fe..01862bfd82 100644 --- a/cli/lib/worker.rs +++ b/cli/lib/worker.rs @@ -196,7 +196,6 @@ struct LibWorkerFactorySharedState { root_cert_store_provider: Arc, shared_array_buffer_store: SharedArrayBufferStore, storage_key_resolver: StorageKeyResolver, - use_lsc_cache: bool, sys: TSys, options: LibMainWorkerOptions, } @@ -327,7 +326,6 @@ impl LibWorkerFactorySharedState { 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, @@ -359,7 +357,6 @@ impl LibMainWorkerFactory { pkg_json_resolver: Arc>, root_cert_store_provider: Arc, storage_key_resolver: StorageKeyResolver, - use_lsc_cache: bool, sys: TSys, options: LibMainWorkerOptions, ) -> Self { @@ -379,7 +376,6 @@ impl LibMainWorkerFactory { root_cert_store_provider, shared_array_buffer_store: Default::default(), storage_key_resolver, - use_lsc_cache, sys, options, }), @@ -504,7 +500,6 @@ impl LibMainWorkerFactory { 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, diff --git a/cli/rt/run.rs b/cli/rt/run.rs index 5bfc4e043f..6f5c05b467 100644 --- a/cli/rt/run.rs +++ b/cli/rt/run.rs @@ -945,7 +945,6 @@ pub async fn run( pkg_json_resolver, root_cert_store_provider, StorageKeyResolver::empty(), - false, sys.clone(), lib_main_worker_options, ); diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index a984c4048f..3cae4e127f 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -376,7 +376,6 @@ pub struct WebWorkerOptions { pub format_js_error_fn: Option>, pub worker_type: WebWorkerType, pub cache_storage_dir: Option, - pub use_lsc_cache: bool, pub stdio: Stdio, pub strace_ops: Option>, pub close_on_idle: bool, @@ -456,6 +455,26 @@ impl WebWorker { let enable_testing_features = options.bootstrap.enable_testing_features; fn create_cache_inner(options: &WebWorkerOptions) -> Option { + if let Ok(var) = std::env::var("DENO_CACHE_LSC_ENDPOINT") { + let elems: Vec<_> = var.split(",").collect(); + if elems.len() == 2 { + let endpoint = elems[0]; + let token = elems[1]; + use deno_cache::CacheShard; + + let shard = + Rc::new(CacheShard::new(endpoint.to_string(), token.to_string())); + let create_cache_fn = move || { + let x = deno_cache::LscBackend::default(); + x.set_shard(shard.clone()); + + Ok(CacheImpl::Lsc(x)) + }; + #[allow(clippy::arc_with_non_send_sync)] + return Some(CreateCache(Arc::new(create_cache_fn))); + } + } + if let Some(storage_dir) = &options.cache_storage_dir { let storage_dir = storage_dir.clone(); let create_cache_fn = move || { @@ -465,25 +484,6 @@ impl WebWorker { return Some(CreateCache(Arc::new(create_cache_fn))); } - if options.use_lsc_cache { - use deno_cache::CacheShard; - let Ok(endpoint) = std::env::var("LSC_ENDPOINT") else { - return None; - }; - let Ok(token) = std::env::var("LSC_TOKEN") else { - return None; - }; - let shard = Rc::new(CacheShard::new(endpoint, token)); - let create_cache_fn = move || { - let x = deno_cache::LscBackend::default(); - x.set_shard(shard.clone()); - - Ok(CacheImpl::Lsc(x)) - }; - #[allow(clippy::arc_with_non_send_sync)] - return Some(CreateCache(Arc::new(create_cache_fn))); - } - None } let create_cache = create_cache_inner(&options); diff --git a/runtime/worker.rs b/runtime/worker.rs index 2a9ae7f665..d6f720073e 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -200,7 +200,6 @@ pub struct WorkerOptions { pub strace_ops: Option>, pub cache_storage_dir: Option, - pub use_lsc_cache: bool, pub origin_storage_dir: Option, pub stdio: Stdio, pub enable_stack_trace_arg_in_ops: bool, @@ -222,7 +221,6 @@ impl Default for WorkerOptions { format_js_error_fn: Default::default(), origin_storage_dir: Default::default(), cache_storage_dir: Default::default(), - use_lsc_cache: false, extensions: Default::default(), startup_snapshot: Default::default(), create_params: Default::default(), @@ -344,6 +342,26 @@ impl MainWorker { ); fn create_cache_inner(options: &WorkerOptions) -> Option { + if let Ok(var) = std::env::var("DENO_CACHE_LSC_ENDPOINT") { + let elems: Vec<_> = var.split(",").collect(); + if elems.len() == 2 { + let endpoint = elems[0]; + let token = elems[1]; + use deno_cache::CacheShard; + + let shard = + Rc::new(CacheShard::new(endpoint.to_string(), token.to_string())); + let create_cache_fn = move || { + let x = deno_cache::LscBackend::default(); + x.set_shard(shard.clone()); + + Ok(CacheImpl::Lsc(x)) + }; + #[allow(clippy::arc_with_non_send_sync)] + return Some(CreateCache(Arc::new(create_cache_fn))); + } + } + if let Some(storage_dir) = &options.cache_storage_dir { let storage_dir = storage_dir.clone(); let create_cache_fn = move || { @@ -353,25 +371,6 @@ impl MainWorker { return Some(CreateCache(Arc::new(create_cache_fn))); } - if options.use_lsc_cache { - use deno_cache::CacheShard; - let Ok(endpoint) = std::env::var("LSC_ENDPOINT") else { - return None; - }; - let Ok(token) = std::env::var("LSC_TOKEN") else { - return None; - }; - let shard = Rc::new(CacheShard::new(endpoint, token)); - let create_cache_fn = move || { - let x = deno_cache::LscBackend::default(); - x.set_shard(shard.clone()); - - Ok(CacheImpl::Lsc(x)) - }; - #[allow(clippy::arc_with_non_send_sync)] - return Some(CreateCache(Arc::new(create_cache_fn))); - } - None } let create_cache = create_cache_inner(&options);