async fn send_watch_response_with_watch_id(
        sender: LockedDuplexSink,
        kv: KeyValue,
        prev_kv: Option<KeyValue>,
        watch_id: i64,
        event_type: Event_EventType,
    ) {
        let mut event = Event::new();
        event.set_field_type(event_type);
        if let Some(value) = prev_kv {
            event.set_prev_kv(value);
        }
        event.set_kv(kv);

        let mut response = WatchResponse::new();
        response.set_watch_id(watch_id);
        response.set_events(RepeatedField::from_vec([event].to_vec()));

        sender
            .lock()
            .await
            .send((response, WriteFlags::default()))
            .await
            .unwrap_or_else(|e| panic!("Fail to send watch response, the error is {}", e));
    }
/// Send watch response for a specific watch id to etcd client
Send watch response for a specific watch id to etcd client
Send watch response for a specific watch id to etcd client
async fn send_watch_response_with_watch_id(
        sender: LockedDuplexSink,
        kv: KeyValue,
        prev_kv: Option<KeyValue>,
        watch_id: i64,
        event_type: Event_EventType,
    ) {
        let mut event = Event::new();
        event.set_field_type(event_type);
        if let Some(value) = prev_kv {
            event.set_prev_kv(value);
        }
        event.set_kv(kv);
        let mut response = WatchResponse::new();
        response.set_watch_id(watch_id);
        response.set_events(RepeatedField::from_vec([event].to_vec()));
        sender
            .lock()
            .await
            .send((response, WriteFlags::default()))
            .await
            .unwrap_or_else(|e| panic!("Fail to send watch response, the error is {}", e));
    }
async fn send_watch_response_with_watch_id ( sender : LockedDuplexSink , kv : KeyValue , prev_kv : Option < KeyValue > , watch_id : i64 , event_type : Event_EventType , ) { let mut event = Event :: new ( ) ; event . set_field_type ( event_type ) ; if let Some ( value ) = prev_kv { event . set_prev_kv ( value ) ; } event . set_kv ( kv ) ; let mut response = WatchResponse :: new ( ) ; response . set_watch_id ( watch_id ) ; response . set_events ( RepeatedField :: from_vec ( [ event ] . to_vec ( ) ) ) ; sender . lock ( ) . await . send ( ( response , WriteFlags :: default ( ) ) ) . await . unwrap_or_else ( | e | panic ! ( " " e ) ) ; }
Send watch response for a specific watch id to etcd client
Send watch response for a specific watch id to etcd client
sender
LockedDuplexSink
kv
KeyValue
prev_kv
Option<KeyValue>
watch_id
i64
event_type
Event_EventType