From c44dd081dbae16b7cdf2bb32ea300096884b7b73 Mon Sep 17 00:00:00 2001 From: eitanm-starkware Date: Tue, 16 Jul 2024 13:42:43 +0300 Subject: [PATCH] chore(network): conversion from SyncClientQueryForNetwork to SyncClientQuery --- .../src/network_manager/mod.rs | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/crates/papyrus_network/src/network_manager/mod.rs b/crates/papyrus_network/src/network_manager/mod.rs index db932279bd..d754195e63 100644 --- a/crates/papyrus_network/src/network_manager/mod.rs +++ b/crates/papyrus_network/src/network_manager/mod.rs @@ -614,32 +614,55 @@ pub fn dummy_report_sender() -> ReportSender { } pub type GenericSender = Box>; -pub type GenericReceiver = Box>; +// Box implements Stream only if S: Stream + Unpin +pub type GenericReceiver = Box + Unpin>; -pub struct SqmrClientQuery> { +pub struct SqmrClientPayload> { pub query: Query, pub report_receiver: oneshot::Receiver<()>, pub responses_sender: GenericSender>::Error>>, } -// TODO(shahak): Return this type in register_sqmr_protocol_client -pub type SqmrClientChannel = GenericSender>; - -pub struct SqmrServerQuery> { +pub struct SqmrServerPayload> { pub query: Query, pub report_sender: oneshot::Sender<()>, pub responses_sender: GenericSender>::Error>>, } -// TODO(shahak): Return this type in register_sqmr_protocol_server -pub type SqmrServerChannel = GenericReceiver>; #[allow(dead_code)] -struct SqmrClientQueryForNetwork { +struct SqmrClientPayloadForNetwork { pub query: Bytes, pub report_receiver: BoxFuture<'static, SessionId>, pub responses_sender: GenericSender, } + +// TODO(shahak): Return this type in register_sqmr_protocol_client +pub type SqmrClientSender = GenericSender>; +#[allow(dead_code)] +type SqmrClientReceiver = GenericReceiver; + +// TODO(shahak): Return this type in register_sqmr_protocol_server +pub type SqmrServerReceiver = GenericReceiver>; +#[allow(dead_code)] +type SqmrServerSender = GenericSender; + +impl> From> + for SqmrClientPayloadForNetwork +{ + fn from(_query: SqmrClientPayload) -> Self { + unimplemented!() + } +} + +impl> From + for SqmrServerPayload +{ + fn from(_query: SqmrServerPayloadForNetwork) -> Self { + unimplemented!() + } +} + #[allow(dead_code)] -struct SqmrServerQueryForNetwork { +struct SqmrServerPayloadForNetwork { pub query: Bytes, pub report_sender: oneshot::Sender<()>, pub responses_sender: GenericSender,