@@ -28,25 +28,22 @@ use databend_common_pipeline::sinks::AsyncSink;
2828use databend_common_pipeline:: sinks:: AsyncSinker ;
2929
3030use super :: serde:: ExchangeSerializeMeta ;
31- use crate :: servers:: flight:: v1:: exchange :: exchange_packet_sender :: ExchangePacketSender ;
31+ use crate :: servers:: flight:: v1:: transport :: OutboundStreamRef ;
3232use crate :: servers:: flight:: v1:: transport:: StreamSendOutcome ;
3333
3434pub struct ExchangePacketSink {
35- sender : Arc < ExchangePacketSender > ,
36- destination : usize ,
35+ stream : OutboundStreamRef ,
3736 ignore_exchange : bool ,
3837}
3938
4039impl ExchangePacketSink {
4140 fn create (
4241 input : Arc < InputPort > ,
43- sender : Arc < ExchangePacketSender > ,
44- destination : usize ,
42+ stream : OutboundStreamRef ,
4543 ignore_exchange : bool ,
4644 ) -> ProcessorPtr {
4745 ProcessorPtr :: create ( AsyncSinker :: create ( input, Self {
48- sender,
49- destination,
46+ stream,
5047 ignore_exchange,
5148 } ) )
5249 }
@@ -57,7 +54,7 @@ impl AsyncSink for ExchangePacketSink {
5754 const NAME : & ' static str = "ExchangePacketSink" ;
5855
5956 async fn on_finish ( & mut self ) -> Result < ( ) > {
60- self . sender . finish_producer ( ) . await
57+ self . stream . finish ( ) . await
6158 }
6259
6360 async fn consume ( & mut self , mut data_block : DataBlock ) -> Result < bool > {
@@ -77,9 +74,7 @@ impl AsyncSink for ExchangePacketSink {
7774 bytes += packet. bytes_size ( ) ;
7875 let flight_data = FlightData :: try_from ( packet) ?;
7976
80- if self . sender . send ( 0 , self . destination , flight_data) . await ?
81- == StreamSendOutcome :: ConsumerClosed
82- {
77+ if self . stream . send ( 0 , flight_data) . await ? == StreamSendOutcome :: ConsumerClosed {
8378 return Ok ( true ) ;
8479 }
8580 }
@@ -89,14 +84,10 @@ impl AsyncSink for ExchangePacketSink {
8984 }
9085}
9186
92- pub fn create_packet_writer_item (
93- sender : Arc < ExchangePacketSender > ,
94- destination : usize ,
95- ignore_exchange : bool ,
96- ) -> PipeItem {
87+ pub fn create_packet_writer_item ( stream : OutboundStreamRef , ignore_exchange : bool ) -> PipeItem {
9788 let input = InputPort :: create ( ) ;
9889 PipeItem :: create (
99- ExchangePacketSink :: create ( input. clone ( ) , sender , destination , ignore_exchange) ,
90+ ExchangePacketSink :: create ( input. clone ( ) , stream , ignore_exchange) ,
10091 vec ! [ input] ,
10192 vec ! [ ] ,
10293 )
0 commit comments