mod.rs

Overview

This Rust source file serves as a central module aggregator and encapsulates functionalities related to block state management, persistence, and validation within the system. It exposes several submodules responsible for handling different aspects of the block state lifecycle, including attestation checkpoints, inner block states, state repositories, unfinalized ancestor blocks, and utility tools. Additionally, it provides a service for asynchronously saving state to persistent storage.

Internally, the file includes a private submodule that manages the loading and saving of block state data from and to the filesystem, currently using file-based persistence with plans to migrate to an embedded database.

Modules and Exports

Private Module: private

This module encapsulates file-based persistence logic for AckiNackiBlockState. It is not exposed outside this file, ensuring encapsulation of storage details.

Functions

load_state(file_path: PathBuf) -> anyhow::Result<Option<AckiNackiBlockState>>

save(state: &AckiNackiBlockState) -> anyhow::Result<()>

Interaction with Other Parts of the System

Important Implementation Notes

Mermaid Diagram

classDiagram
class AckiNackiBlockState {
+file_path: PathBuf
}
class private {
+load_state(file_path: PathBuf) Result<Option<AckiNackiBlockState>>
+save(state: &AckiNackiBlockState) Result<()>
}
class save_service {
+start_state_save_service()
}
mod_rs --> attestation_target_checkpoints
mod_rs --> block_state_inner
mod_rs --> repository
mod_rs --> save_service
mod_rs --> state
mod_rs --> tools
mod_rs --> unfinalized_ancestor_blocks
mod_rs --> private
private ..> AckiNackiBlockState : uses
private o--> repository : uses load/save functions
save_service ..> AckiNackiBlockState : manages saving

This diagram illustrates the main components exposed or encapsulated within the file and their relationships, focusing on the private persistence functions and how they operate with the AckiNackiBlockState entity and other modules.