mod.rs
Overview
This file serves as a central module aggregator and re-exporter within its parent crate. It organizes and exposes key submodules and their associated types, structs, and handlers related to blockchain set management, message handling, and storage functionalities. By consolidating these exports, mod.rs enables other parts of the application to access these core components through a simplified interface.
The primary responsibilities and functionalities covered by the submodules include:
Managing blockchain set summaries and updates.
Handling BOC (Bag of Cells) data retrieval by address.
Tracking default thread sequence numbers.
Managing external messages processing.
Providing latest storage state access.
Modules and Their Purpose
bk_set_summary
Handles the summarization of blockchain sets. This module provides abstractions to create summaries and snapshots of blockchain set data, along with result types and handlers to process these summaries.
Exported Types:
BkSetSummary: Represents a summary of a blockchain set.BkSetSummaryHandler: Processes blockchain set summary operations.BkSetSummaryResult: Represents the outcome of summary processing.BkSetSummarySnapshot: Captures a snapshot view of the blockchain set summary.BkSummary: A lower-level summary abstraction.
bk_set_update
Responsible for blockchain set updates and API-related structures. This module exposes types that allow interaction with API-level blockchain sets, public keys, and status tracking.
Exported Types:
ApiBk: Represents an API-level blockchain entity.ApiBkSet: Represents a set of blockchain entities from the API perspective.ApiBkSetHandler: Processes API blockchain set updates.ApiBkSetSnapshot: Captures a snapshot of an API blockchain set.ApiBkStatus: Represents the status of an API blockchain entity or set.ApiPubKey: Represents a public key used in API-related blockchain operations.ApiUInt256: Represents a 256-bit unsigned integer, typically used for hashes or unique identifiers.
boc_by_address
Provides functionalities to retrieve BOC (Bag of Cells) data by blockchain addresses.
Exported Types:
BocByAddressHandler: Handles retrieval and processing of BOC data indexed by address.
default_thread_seqno
Manages thread sequence numbers, typically used for tracking message ordering or thread progress.
Exported Types:
LastSeqnoHandler: Handles fetching and updating the last known sequence number for threads.
ext_messages
Contains logic for handling external messages. This module is declared as pub(crate) indicating internal visibility within the crate.
storage_latest
Manages access to the latest storage state.
Exported Types:
StorageLatestHandler: Handles operations related to retrieving or updating the latest state in storage.
Interaction with Other System Parts
This module acts as a façade aggregating submodules that handle different aspects of blockchain data management and messaging. It provides a streamlined interface for other components to:
Generate and update blockchain set summaries.
Manage API interactions with blockchain sets.
Access and process BOC data by address.
Track thread sequence numbers for message ordering.
Handle external messages within the system's messaging infrastructure.
Access the latest storage state efficiently.
These components likely interact with networking layers, consensus mechanisms, and storage subsystems in the broader application, though those interactions are managed within each submodule and their handlers.
Key Implementation Details
The file itself does not contain implementation logic but re-exports types and handlers for use elsewhere.
The
pub(crate)visibility modifier on ext_messages and storage_latest modules indicates they are intended for internal crate use and are not exposed publicly.The naming conventions (e.g.,
Handler,Snapshot,Result) suggest a pattern of separating data structures, processing logic, and state capture.The use of types like
ApiUInt256andApiPubKeyimplies cryptographic and unique identifier handling consistent with blockchain data management.
Usage Example
Other modules can import and use the exposed components as follows:
use crate::mod_name::{BkSetSummaryHandler, ApiBkSetHandler, BocByAddressHandler};
// Create a handler for blockchain set summaries
let summary_handler = BkSetSummaryHandler::new();
// Use the handler to process updates or retrieve summaries
let summary_result = summary_handler.process_summary();
// Similarly, use API handlers
let api_handler = ApiBkSetHandler::new();
let api_snapshot = api_handler.get_snapshot();
// Retrieve BOC data by address
let boc_handler = BocByAddressHandler::new();
let boc_data = boc_handler.get_boc_by_address(address);
Mermaid Diagram
classDiagram
class BkSetSummary {
}
class BkSetSummaryHandler {
+process_summary()
}
class BkSetSummaryResult {
}
class BkSetSummarySnapshot {
}
class BkSummary {
}
class ApiBk {
}
class ApiBkSet {
}
class ApiBkSetHandler {
+process_update()
+get_snapshot()
}
class ApiBkSetSnapshot {
}
class ApiBkStatus {
}
class ApiPubKey {
}
class ApiUInt256 {
}
class BocByAddressHandler {
+get_boc_by_address()
}
class LastSeqnoHandler {
+get_last_seqno()
+update_seqno()
}
class StorageLatestHandler {
+get_latest_state()
+update_latest_state()
}
BkSetSummaryHandler --> BkSetSummary
BkSetSummaryHandler --> BkSetSummaryResult
BkSetSummaryHandler --> BkSetSummarySnapshot
ApiBkSetHandler --> ApiBkSet
ApiBkSetHandler --> ApiBkSetSnapshot
ApiBkSetHandler --> ApiBk
ApiBkSetHandler --> ApiBkStatus
ApiBkSetHandler --> ApiPubKey
ApiBkSetHandler --> ApiUInt256
BocByAddressHandler ..> "BOC Data"
LastSeqnoHandler ..> "Thread Seqno"
StorageLatestHandler ..> "Storage State"
This diagram visualizes the main types and their relationships within this file, focusing on the handlers and their corresponding data structures.