Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(network): add docs for some of the public structs #1925

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/papyrus_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl From<DataType> for Protocol {
}
}

/// This struct represents a query that can be sent to a peer.
#[derive(Default, Debug, PartialEq, Eq)]
pub struct Query {
pub start_block: BlockNumber,
Expand Down Expand Up @@ -140,11 +141,16 @@ pub enum BlockHashOrNumber {
pub type SignedBlockHeaderStream = Pin<Box<dyn Stream<Item = Option<SignedBlockHeader>> + Send>>;
pub type StateDiffStream = Pin<Box<dyn Stream<Item = Option<ThinStateDiff>> + Send>>;

/// This struct represents the receiver end of the response streams for a network subscriber.
/// It is created by the network manager and passed to the subscriber when calling
/// register_subscriber.
pub struct ResponseReceivers {
pub signed_headers_receiver: Option<SignedBlockHeaderStream>,
pub state_diffs_receiver: Option<StateDiffStream>,
}

/// This is a part of the exposed API of the network manager.
/// This is meant to represent the different underlying p2p protocols the network manager supports.
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Sequence)]
pub enum Protocol {
SignedBlockHeader,
Expand Down
Loading