| 284 | /// Panics if the batch insert operation fails. |
| 285 | #[allow(dead_code)] |
| 286 | pub(crate) async fn insert_raft_log( |
| 287 | raft_log: &Arc<ROF<RaftTypeConfig<FileStorageEngine, FileStateMachine>>>, |
| 288 | ids: Vec<u64>, |
| 289 | term: u64, |
| 290 | ) { |
| 291 | let mut entries = Vec::new(); |
| 292 | for id in ids { |
| 293 | let log = Entry { |
| 294 | index: raft_log.pre_allocate_raft_logs_next_index(), |
| 295 | term, |
| 296 | payload: Some(EntryPayload::command(generate_insert_commands(vec![id]))), |
| 297 | }; |
| 298 | entries.push(log); |
| 299 | } |
| 300 | if let Err(e) = raft_log.insert_batch(entries).await { |
| 301 | panic!("error:{e:?}"); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | /// Applies entries to the state machine with specified IDs and term. |
| 306 | /// |