mirror of
https://github.com/denoland/deno.git
synced 2025-02-07 23:06:50 -05:00
wip
This commit is contained in:
parent
f7f8274881
commit
9b119bcd31
1 changed files with 22 additions and 3 deletions
|
@ -376,6 +376,7 @@ pub struct WebWorkerOptions {
|
||||||
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
|
||||||
pub worker_type: WebWorkerType,
|
pub worker_type: WebWorkerType,
|
||||||
pub cache_storage_dir: Option<std::path::PathBuf>,
|
pub cache_storage_dir: Option<std::path::PathBuf>,
|
||||||
|
pub use_lsc_cache: bool,
|
||||||
pub stdio: Stdio,
|
pub stdio: Stdio,
|
||||||
pub strace_ops: Option<Vec<String>>,
|
pub strace_ops: Option<Vec<String>>,
|
||||||
pub close_on_idle: bool,
|
pub close_on_idle: bool,
|
||||||
|
@ -453,10 +454,28 @@ impl WebWorker {
|
||||||
|
|
||||||
// Permissions: many ops depend on this
|
// Permissions: many ops depend on this
|
||||||
let enable_testing_features = options.bootstrap.enable_testing_features;
|
let enable_testing_features = options.bootstrap.enable_testing_features;
|
||||||
let create_cache = options.cache_storage_dir.map(|storage_dir| {
|
let create_cache = 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());
|
||||||
|
|
||||||
|
x
|
||||||
|
};
|
||||||
|
Some(CreateCache(Arc::new(create_cache_fn)))
|
||||||
|
} else if let Some(storage_dir) = options.cache_storage_dir {
|
||||||
let create_cache_fn = move || SqliteBackedCache::new(storage_dir.clone());
|
let create_cache_fn = move || SqliteBackedCache::new(storage_dir.clone());
|
||||||
CreateCache(Arc::new(create_cache_fn))
|
Some(CreateCache(Arc::new(create_cache_fn)))
|
||||||
});
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
// NOTE(bartlomieju): ordering is important here, keep it in sync with
|
// NOTE(bartlomieju): ordering is important here, keep it in sync with
|
||||||
// `runtime/worker.rs` and `runtime/snapshot.rs`!
|
// `runtime/worker.rs` and `runtime/snapshot.rs`!
|
||||||
|
|
Loading…
Add table
Reference in a new issue