mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
synchronize most of the operations
This commit is contained in:
parent
145f0e753c
commit
6cc14feb51
7 changed files with 447 additions and 37 deletions
|
@ -1,9 +1,11 @@
|
|||
use std::net::ToSocketAddrs;
|
||||
|
||||
use batch::Batch;
|
||||
use ductile::{connect_channel, ChannelReceiver, ChannelSender};
|
||||
use meilisearch_types::tasks::KindWithContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod batch;
|
||||
mod leader;
|
||||
|
||||
pub use leader::Leader;
|
||||
|
@ -19,7 +21,7 @@ pub enum Error {
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum LeaderMsg {
|
||||
// Starts a new batch
|
||||
StartBatch { id: u32, batch: Vec<u32> },
|
||||
StartBatch { id: u32, batch: Batch },
|
||||
// Tell the follower to commit the update asap
|
||||
Commit(u32),
|
||||
}
|
||||
|
@ -52,7 +54,7 @@ impl Follower {
|
|||
Follower { sender, receiver, batch_id: 0 }
|
||||
}
|
||||
|
||||
pub fn get_new_batch(&mut self) -> Vec<u32> {
|
||||
pub fn get_new_batch(&mut self) -> Batch {
|
||||
loop {
|
||||
match self.receiver.recv() {
|
||||
Ok(LeaderMsg::StartBatch { id, batch }) if id == self.batch_id => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue