@@ -37,7 +37,7 @@ use linera_service::util;
3737#[ cfg( with_metrics) ]
3838use linera_service:: { prometheus_server, pyroscope_server} ;
3939use linera_storage:: Storage ;
40- use linera_views:: store:: CommonStoreConfig ;
40+ use linera_views:: { lru_caching :: StorageCacheConfig , store:: CommonStoreConfig } ;
4141use serde:: Deserialize ;
4242use tokio:: task:: JoinSet ;
4343use tokio_util:: sync:: CancellationToken ;
@@ -414,9 +414,17 @@ enum ServerCommand {
414414 #[ arg( long, default_value = "10" ) ]
415415 max_stream_queries : usize ,
416416
417+ /// The maximal memory used in the storage cache.
418+ #[ arg( long, default_value = "10000000" ) ]
419+ max_cache_size : usize ,
420+
421+ /// The maximal size of an entry in the storage cache.
422+ #[ arg( long, default_value = "1000000" ) ]
423+ max_entry_size : usize ,
424+
417425 /// The maximal number of entries in the storage cache.
418426 #[ arg( long, default_value = "1000" ) ]
419- cache_size : usize ,
427+ max_cache_entries : usize ,
420428 } ,
421429
422430 /// Act as a trusted third-party and generate all server configurations
@@ -455,9 +463,17 @@ enum ServerCommand {
455463 #[ arg( long, default_value = "10" ) ]
456464 max_stream_queries : usize ,
457465
466+ /// The maximal memory used in the storage cache.
467+ #[ arg( long, default_value = "10000000" ) ]
468+ max_cache_size : usize ,
469+
470+ /// The maximal size of an entry in the storage cache.
471+ #[ arg( long, default_value = "1000000" ) ]
472+ max_entry_size : usize ,
473+
458474 /// The maximal number of entries in the storage cache.
459475 #[ arg( long, default_value = "1000" ) ]
460- cache_size : usize ,
476+ max_cache_entries : usize ,
461477 } ,
462478
463479 /// Replaces the configurations of the shards by following the given template.
@@ -567,7 +583,9 @@ async fn run(options: ServerOptions) {
567583 max_loaded_chains,
568584 max_concurrent_queries,
569585 max_stream_queries,
570- cache_size,
586+ max_cache_size,
587+ max_entry_size,
588+ max_cache_entries,
571589 } => {
572590 linera_version:: VERSION_INFO . log ( ) ;
573591
@@ -585,10 +603,15 @@ async fn run(options: ServerOptions) {
585603 max_loaded_chains,
586604 } ;
587605 let wasm_runtime = wasm_runtime. with_wasm_default ( ) ;
606+ let storage_cache_config = StorageCacheConfig {
607+ max_cache_size,
608+ max_entry_size,
609+ max_cache_entries,
610+ } ;
588611 let common_config = CommonStoreConfig {
589612 max_concurrent_queries,
590613 max_stream_queries,
591- cache_size ,
614+ storage_cache_config ,
592615 } ;
593616 let full_storage_config = storage_config
594617 . add_common_config ( common_config)
@@ -647,14 +670,21 @@ async fn run(options: ServerOptions) {
647670 genesis_config_path,
648671 max_concurrent_queries,
649672 max_stream_queries,
650- cache_size,
673+ max_cache_size,
674+ max_entry_size,
675+ max_cache_entries,
651676 } => {
652677 let genesis_config: GenesisConfig =
653678 util:: read_json ( & genesis_config_path) . expect ( "Failed to read initial chain config" ) ;
679+ let storage_cache_config = StorageCacheConfig {
680+ max_cache_size,
681+ max_entry_size,
682+ max_cache_entries,
683+ } ;
654684 let common_config = CommonStoreConfig {
655685 max_concurrent_queries,
656686 max_stream_queries,
657- cache_size ,
687+ storage_cache_config ,
658688 } ;
659689 let full_storage_config = storage_config
660690 . add_common_config ( common_config)
0 commit comments