Skip to content

Commit

Permalink
refactor(papyrus_p2p_sync): rename stream builder
Browse files Browse the repository at this point in the history
  • Loading branch information
eitanm-starkware committed Jan 12, 2025
1 parent 3d4a638 commit 997b0ed
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions crates/papyrus_p2p_sync/src/client/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use super::stream_builder::{
BadPeerError,
BlockData,
BlockNumberLimit,
DataStreamBuilder,
ParseDataError,
StreamBuilder,
};
use super::{P2PSyncClientError, NETWORK_DATA_TIMEOUT};

Expand All @@ -44,7 +44,7 @@ impl BlockData for (DeclaredClasses, DeprecatedDeclaredClasses, BlockNumber) {

pub(crate) struct ClassStreamBuilder;

impl DataStreamBuilder<(ApiContractClass, ClassHash)> for ClassStreamBuilder {
impl StreamBuilder<(ApiContractClass, ClassHash)> for ClassStreamBuilder {
type Output = (DeclaredClasses, DeprecatedDeclaredClasses, BlockNumber);

const TYPE_DESCRIPTION: &'static str = "classes";
Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_p2p_sync/src/client/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use super::stream_builder::{
BadPeerError,
BlockData,
BlockNumberLimit,
DataStreamBuilder,
ParseDataError,
StreamBuilder,
};
use super::{P2PSyncClientError, ALLOWED_SIGNATURES_LENGTH, NETWORK_DATA_TIMEOUT};

Expand Down Expand Up @@ -65,7 +65,7 @@ impl BlockData for SignedBlockHeader {

pub(crate) struct HeaderStreamBuilder;

impl DataStreamBuilder<SignedBlockHeader> for HeaderStreamBuilder {
impl StreamBuilder<SignedBlockHeader> for HeaderStreamBuilder {
type Output = SignedBlockHeader;

const TYPE_DESCRIPTION: &'static str = "headers";
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_p2p_sync/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use starknet_api::core::ClassHash;
use starknet_api::transaction::FullTransaction;
use starknet_state_sync_types::state_sync_types::SyncBlock;
use state_diff::StateDiffStreamBuilder;
use stream_builder::{DataStreamBuilder, DataStreamResult};
use stream_builder::{StreamBuilder, DataStreamResult};
use tokio_stream::StreamExt;
use tracing::{info, instrument};
use transaction::TransactionStreamFactory;
Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_p2p_sync/src/client/state_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::stream_builder::BadPeerError;
use crate::client::stream_builder::{
BlockData,
BlockNumberLimit,
DataStreamBuilder,
StreamBuilder,
ParseDataError,
};
use crate::client::{P2PSyncClientError, NETWORK_DATA_TIMEOUT};
Expand All @@ -38,7 +38,7 @@ impl BlockData for (ThinStateDiff, BlockNumber) {

pub(crate) struct StateDiffStreamBuilder;

impl DataStreamBuilder<StateDiffChunk> for StateDiffStreamBuilder {
impl StreamBuilder<StateDiffChunk> for StateDiffStreamBuilder {
type Output = (ThinStateDiff, BlockNumber);

const TYPE_DESCRIPTION: &'static str = "state diffs";
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_p2p_sync/src/client/stream_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) enum BlockNumberLimit {
StateDiffMarker,
}

pub(crate) trait DataStreamBuilder<InputFromNetwork>
pub(crate) trait StreamBuilder<InputFromNetwork>
where
InputFromNetwork: Send + 'static,
DataOrFin<InputFromNetwork>: TryFrom<Vec<u8>, Error = ProtobufConversionError>,
Expand Down
4 changes: 2 additions & 2 deletions crates/papyrus_p2p_sync/src/client/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::stream_builder::{
BadPeerError,
BlockData,
BlockNumberLimit,
DataStreamBuilder,
StreamBuilder,
ParseDataError,
};
use super::{P2PSyncClientError, NETWORK_DATA_TIMEOUT};
Expand All @@ -30,7 +30,7 @@ impl BlockData for (BlockBody, BlockNumber) {

pub(crate) struct TransactionStreamFactory;

impl DataStreamBuilder<FullTransaction> for TransactionStreamFactory {
impl StreamBuilder<FullTransaction> for TransactionStreamFactory {
// TODO(Eitan): Add events protocol to BlockBody or split their write to storage
type Output = (BlockBody, BlockNumber);

Expand Down

0 comments on commit 997b0ed

Please sign in to comment.