2024-04-17 10:19:55 -04:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
2024-05-24 10:15:46 -04:00
|
|
|
use deno_core::ModuleSpecifier;
|
|
|
|
|
2024-11-18 15:09:28 -05:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-04-17 10:19:55 -04:00
|
|
|
pub enum CodeCacheType {
|
|
|
|
EsModule,
|
|
|
|
Script,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait CodeCache: Send + Sync {
|
|
|
|
fn get_sync(
|
|
|
|
&self,
|
2024-05-24 10:15:46 -04:00
|
|
|
specifier: &ModuleSpecifier,
|
2024-04-17 10:19:55 -04:00
|
|
|
code_cache_type: CodeCacheType,
|
2024-05-24 10:15:46 -04:00
|
|
|
source_hash: u64,
|
2024-04-17 10:19:55 -04:00
|
|
|
) -> Option<Vec<u8>>;
|
2024-11-18 15:09:28 -05:00
|
|
|
|
2024-04-17 10:19:55 -04:00
|
|
|
fn set_sync(
|
|
|
|
&self,
|
2024-05-24 10:15:46 -04:00
|
|
|
specifier: ModuleSpecifier,
|
2024-04-17 10:19:55 -04:00
|
|
|
code_cache_type: CodeCacheType,
|
2024-05-24 10:15:46 -04:00
|
|
|
source_hash: u64,
|
2024-04-17 10:19:55 -04:00
|
|
|
data: &[u8],
|
|
|
|
);
|
|
|
|
}
|