// Wait until the given index has been committed
Wait until the given index has been committed
Wait until the given index has been committed
pub fn sync(&self, index: u64) -> impl Future<Output = Result<(), ErrorCode>> {
        // Make sure we have the lock on all data structures
        let _raft_node_locked = self.raft_node.lock().unwrap();
        if self.applied_index.load(Ordering::SeqCst) >= index {
            Either::Left(ready(Ok(())))
        } else {
            let (sender, receiver) = oneshot::channel();
            self.sync_requests.lock().unwrap().push((index, sender));
            Either::Right(receiver.map(|x| x.map_err(|_| ErrorCode::Uncategorized)))
        }
    }
pub fn sync ( & self , index : u64 ) -> impl Future < Output = Result < ( ) , ErrorCode > > { // Make sure we have the lock on all data structures let _raft_node_locked = self . raft_node . lock ( ) . unwrap ( ) ; if self . applied_index . load ( Ordering :: SeqCst ) >= index { Either :: Left ( ready ( Ok ( ( ) ) ) ) } else { let ( sender , receiver ) = oneshot :: channel ( ) ; self . sync_requests . lock ( ) . unwrap ( ) . push ( ( index , sender ) ) ; Either :: Right ( receiver . map ( | x | x . map_err ( | _ | ErrorCode :: Uncategorized ) ) ) } }
Wait until the given index has been committed
Wait until the given index has been committed
&self
index
u64