@@ -55,7 +55,7 @@ use crate::services::card::{CardService, CardServiceDefault};
5555use crate :: services:: component:: ComponentService ;
5656use crate :: services:: events:: Events ;
5757use crate :: services:: golem_config:: {
58- EngineConfig , GolemConfig , HttpClientConfig , IndexedStorageConfig , KeyValueStorageConfig ,
58+ GolemConfig , HttpClientConfig , IndexedStorageConfig , KeyValueStorageConfig ,
5959 KeyValueStorageInnerConfig , SchedulerStorageConfig ,
6060} ;
6161use crate :: services:: key_value:: { DefaultKeyValueService , KeyValueService } ;
@@ -135,8 +135,8 @@ use tonic::transport::Server;
135135use tonic_tracing_opentelemetry:: middleware;
136136use tonic_tracing_opentelemetry:: middleware:: filters;
137137use tracing:: { Instrument , info} ;
138+ use wasmtime:: Engine ;
138139use wasmtime:: component:: { HasSelf , Linker } ;
139- use wasmtime:: { Config , Engine , WasmBacktraceDetails } ;
140140
141141pub struct RunDetails {
142142 pub http_port : u16 ,
@@ -463,34 +463,6 @@ pub trait Bootstrap<Ctx: WorkerCtx> {
463463 ) )
464464 }
465465
466- /// Can be overridden to customize the wasmtime configuration
467- fn create_wasmtime_config ( & self , engine_config : & EngineConfig ) -> Config {
468- let mut config = Config :: default ( ) ;
469-
470- config. wasm_multi_value ( true ) ;
471- config. wasm_component_model ( true ) ;
472- // Required for WASI p3: enables the async ABI (stream<T>, future<T>,
473- // async lift/lower, error-context). Without this, components that use
474- // any p3 async builtins fail to instantiate.
475- config. wasm_component_model_async ( true ) ;
476- config. wasm_component_model_error_context ( true ) ;
477- // Golem does not expose wasi-threads or a durable shared-memory runtime.
478- config. wasm_threads ( false ) ;
479- config. shared_memory ( false ) ;
480- config. epoch_interruption ( true ) ;
481- config. consume_fuel ( true ) ;
482- config. wasm_backtrace_details ( WasmBacktraceDetails :: Enable ) ;
483-
484- if engine_config. enable_fs_cache {
485- config. cache ( Some (
486- wasmtime:: Cache :: new ( wasmtime:: CacheConfig :: new ( ) )
487- . expect ( "Failed to initialize cache" ) ,
488- ) ) ;
489- }
490-
491- config
492- }
493-
494466 /// This method is responsible for linking all the host function implementations the worker
495467 /// executor supports.
496468 fn create_wasmtime_linker ( & self , engine : & Engine ) -> anyhow:: Result < Linker < Ctx > > {
@@ -853,7 +825,8 @@ pub async fn create_worker_executor_impl<
853825 shutdown_token. clone ( ) ,
854826 ) ;
855827
856- let config = bootstrap. create_wasmtime_config ( & golem_config. engine ) ;
828+ let config =
829+ golem_common:: wasmtime_config:: create_wasmtime_config ( golem_config. engine . enable_fs_cache ) ;
857830 let engine = Arc :: new ( Engine :: new ( & config) ?) ;
858831 let linker = bootstrap. create_wasmtime_linker ( & engine) ?;
859832
0 commit comments