async fn map_insert(
        map_arc: Arc<RwLock<HashMap<Vec<u8>, KeyValue>>>,
        watch_arc: Arc<RwLock<HashMap<i64, KeyRange>>>,
        watch_response_hashmap_arc: Arc<RwLock<HashMap<i64, LockedDuplexSink>>>,
        req: PutRequest,
    ) -> Option<KeyValue> {
        let mut kv = KeyValue::new();
        kv.set_key(req.get_key().to_vec());
        kv.set_value(req.get_value().to_vec());
        let mut map = map_arc.write().await;
        let prev_kv = map.get(&req.get_key().to_vec()).cloned();
        let insert_res = map.insert(req.get_key().to_vec(), kv.clone());
        Self::send_watch_responses(
            watch_arc,
            watch_response_hashmap_arc,
            kv.clone(),
            prev_kv,
            Event_EventType::PUT,
        )
        .await;
        insert_res
    }
/// Insert a key value from a `PutRequest` to map
Insert a key value from a `PutRequest` to map
Insert a key value from a ` PutRequest ` to map
async fn map_insert(
        map_arc: Arc<RwLock<HashMap<Vec<u8>, KeyValue>>>,
        watch_arc: Arc<RwLock<HashMap<i64, KeyRange>>>,
        watch_response_hashmap_arc: Arc<RwLock<HashMap<i64, LockedDuplexSink>>>,
        req: PutRequest,
    ) -> Option<KeyValue> {
        let mut kv = KeyValue::new();
        kv.set_key(req.get_key().to_vec());
        kv.set_value(req.get_value().to_vec());
        let mut map = map_arc.write().await;
        let prev_kv = map.get(&req.get_key().to_vec()).cloned();
        let insert_res = map.insert(req.get_key().to_vec(), kv.clone());
        Self::send_watch_responses(
            watch_arc,
            watch_response_hashmap_arc,
            kv.clone(),
            prev_kv,
            Event_EventType::PUT,
        )
        .await;
        insert_res
    }
async fn map_insert ( map_arc : Arc < RwLock < HashMap < Vec < u8 > , KeyValue > > > , watch_arc : Arc < RwLock < HashMap < i64 , KeyRange > > > , watch_response_hashmap_arc : Arc < RwLock < HashMap < i64 , LockedDuplexSink > > > , req : PutRequest , ) -> Option < KeyValue > { let mut kv = KeyValue :: new ( ) ; kv . set_key ( req . get_key ( ) . to_vec ( ) ) ; kv . set_value ( req . get_value ( ) . to_vec ( ) ) ; let mut map = map_arc . write ( ) . await ; let prev_kv = map . get ( & req . get_key ( ) . to_vec ( ) ) . cloned ( ) ; let insert_res = map . insert ( req . get_key ( ) . to_vec ( ) , kv . clone ( ) ) ; Self :: send_watch_responses ( watch_arc , watch_response_hashmap_arc , kv . clone ( ) , prev_kv , Event_EventType :: PUT , ) . await ; insert_res }
Insert a key value from a `PutRequest` to map
Insert a key value from a ` PutRequest ` to map
map_arc
Arc<RwLock<HashMap<Vec<u8>, KeyValue>>>
watch_arc
Arc<RwLock<HashMap<i64, KeyRange>>>
watch_response_hashmap_arc
Arc<RwLock<HashMap<i64, LockedDuplexSink>>>
req
PutRequest