This repository has been archived by the owner on Jun 11, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #682 from input-output-hk/upload-blocks
network: Redesign block subscription for upload
- Loading branch information
Showing
10 changed files
with
204 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ pub mod client; | |
pub mod server; | ||
|
||
pub mod gossip; | ||
pub mod subscription; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use chain_core::property::{Block, HasHeader}; | ||
|
||
use std::fmt::{self, Debug}; | ||
|
||
pub enum BlockEvent<B> | ||
where | ||
B: Block + HasHeader, | ||
{ | ||
Announce(<B as HasHeader>::Header), | ||
Solicit(Vec<<B as Block>::Id>), | ||
} | ||
|
||
impl<B> Debug for BlockEvent<B> | ||
where | ||
B: Block + HasHeader, | ||
<B as HasHeader>::Header: Debug, | ||
<B as Block>::Id: Debug, | ||
{ | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match self { | ||
BlockEvent::Announce(header) => f.debug_tuple("Announce").field(header).finish(), | ||
BlockEvent::Solicit(ids) => f.debug_tuple("Solicit").field(ids).finish(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.