MCPcopy Create free account
hub / github.com/SeismicSystems/summit / init

Method init

syncer/src/cache.rs:104–126  ·  view source on GitHub ↗

Initialize the cache manager and its metadata store.

(context: R, cfg: Config, block_codec_config: B::Cfg)

Source from the content-addressed store, hash-verified

102{
103 /// Initialize the cache manager and its metadata store.
104 pub(crate) async fn init(context: R, cfg: Config, block_codec_config: B::Cfg) -> Self {
105 // Initialize metadata
106 let metadata = Metadata::init(
107 context.with_label("metadata"),
108 metadata::Config {
109 partition: format!("{}-metadata", cfg.partition_prefix),
110 codec_config: ((), ()),
111 },
112 )
113 .await
114 .expect("failed to initialize metadata");
115
116 // We don't eagerly initialize any epoch caches here, they will be
117 // initialized on demand, otherwise there could be coordination issues
118 // around the scheme provider.
119 Self {
120 context,
121 cfg,
122 block_codec_config,
123 metadata,
124 caches: BTreeMap::new(),
125 }
126 }
127
128 /// Load all persisted epoch caches so that `find_block` can discover
129 /// blocks written before the last shutdown.

Callers 1

mainFunction · 0.45

Calls 1

initFunction · 0.50

Tested by 1

mainFunction · 0.36