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

Method init_archive

syncer/src/cache.rs:217–246  ·  view source on GitHub ↗

Helper to initialize an archive.

(
        &self,
        epoch: Epoch,
        name: &str,
        codec_config: T::Cfg,
    )

Source from the content-addressed store, hash-verified

215
216 /// Helper to initialize an archive.
217 async fn init_archive<T: CodecShared>(
218 &self,
219 epoch: Epoch,
220 name: &str,
221 codec_config: T::Cfg,
222 ) -> prunable::Archive<TwoCap, R, B::Digest, T> {
223 let start = Instant::now();
224 let cfg = prunable::Config {
225 translator: TwoCap,
226 key_partition: format!("{}-cache-{epoch}-{name}-key", self.cfg.partition_prefix),
227 key_page_cache: self.cfg.key_page_cache.clone(),
228 value_partition: format!("{}-cache-{epoch}-{name}-value", self.cfg.partition_prefix),
229 items_per_section: self.cfg.prunable_items_per_section,
230 compression: None,
231 codec_config,
232 replay_buffer: self.cfg.replay_buffer,
233 key_write_buffer: self.cfg.key_write_buffer,
234 value_write_buffer: self.cfg.value_write_buffer,
235 };
236 let archive = prunable::Archive::init(
237 self.context
238 .with_label(&format!("{name}_{epoch}"))
239 .with_attribute("epoch", epoch),
240 cfg,
241 )
242 .await
243 .unwrap_or_else(|_| panic!("failed to initialize {name} archive"));
244 info!(elapsed = ?start.elapsed(), "restored {name} archive");
245 archive
246 }
247
248 /// Add a verified block to the prunable archive.
249 pub(crate) async fn put_verified(&mut self, round: Round, commitment: B::Digest, block: B) {

Callers 1

init_epochMethod · 0.80

Calls 1

initFunction · 0.50

Tested by

no test coverage detected