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