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

Method init

syncer/src/actor.rs:272–375  ·  view source on GitHub ↗

Create a new application actor.

(
        context: E,
        finalizations_by_height: FC,
        finalized_blocks: FB,
        config: Config<B, P, ES, T>,
    )

Source from the content-addressed store, hash-verified

270 finalizations_by_height: FC,
271 // Finalized blocks stored by height
272 finalized_blocks: FB,
273
274 // ---------- Metrics ----------
275 // Latest height metric
276 #[cfg(feature = "prom")]
277 finalized_height: Gauge,
278 // Latest processed height
279 #[cfg(feature = "prom")]
280 processed_height: Gauge,
281}
282
283impl<E, B, P, FC, FB, ES, T, A> Actor<E, B, P, FC, FB, ES, T, A>
284where
285 E: BufferPooler + CryptoRngCore + Spawner + Metrics + Clock + GClock + Storage,
286 B: Block<Digest = Digest> + Epochable + Viewable,
287 P: Provider<Scope = Epoch, Scheme: Scheme<B::Digest>>,
288 FC: Certificates<BlockDigest = B::Digest, Commitment = B::Digest, Scheme = P::Scheme>,
289 FB: Blocks<Block = B>,
290 ES: Epocher,
291 T: Strategy,
292 A: Acknowledgement,
293{
294 /// Create a new application actor.
295 pub async fn init(
296 context: E,
297 finalizations_by_height: FC,
298 finalized_blocks: FB,
299 config: Config<B, P, ES, T>,
300 ) -> (Self, Mailbox<P::Scheme, B>) {
301 // Initialize cache
302 let prunable_config = cache::Config {
303 partition_prefix: config.partition_prefix.clone(),
304 prunable_items_per_section: config.prunable_items_per_section,
305 replay_buffer: config.replay_buffer,
306 key_write_buffer: config.key_write_buffer,
307 value_write_buffer: config.value_write_buffer,
308 key_page_cache: config.page_cache.clone(),
309 };
310 let cache = cache::Manager::init(
311 context.with_label("cache"),
312 prunable_config,
313 config.block_codec_config.clone(),
314 )
315 .await;
316
317 // Initialize metadata tracking application progress
318 let application_metadata = Metadata::init(
319 context.with_label("application_metadata"),
320 metadata::Config {
321 partition: format!("{}-application-metadata", config.partition_prefix),
322 codec_config: (),
323 },
324 )
325 .await
326 .expect("failed to initialize application metadata");
327
328 // Create metrics
329 #[cfg(feature = "prom")]

Callers

nothing calls this directly

Calls 3

registerMethod · 0.80
getMethod · 0.80
initFunction · 0.50

Tested by

no test coverage detected