diff --git a/async-raft/src/core/append_entries.rs b/async-raft/src/core/append_entries.rs index 71d8056ba..a319685ad 100644 --- a/async-raft/src/core/append_entries.rs +++ b/async-raft/src/core/append_entries.rs @@ -264,7 +264,7 @@ impl, S: RaftStorage> Ra // Create a new vector of references to the entries data ... might have to change this // interface a bit before 1.0. let entries_refs: Vec<_> = entries.iter().collect(); - storage.replicate_to_state_machine(&entries_refs).await?; + storage.apply_to_state_machine(&entries_refs).await?; Ok(last_log_id) } .instrument(tracing::debug_span!("spawn")), @@ -301,7 +301,7 @@ impl, S: RaftStorage> Ra if data_entries.is_empty() { return Ok(new_last_applied); } - storage.replicate_to_state_machine(&data_entries).await?; + storage.apply_to_state_machine(&data_entries).await?; Ok(new_last_applied) } .instrument(tracing::debug_span!("spawn-init-replicate-to-sm")), diff --git a/async-raft/src/core/client.rs b/async-raft/src/core/client.rs index 3cfd10afa..694722e93 100644 --- a/async-raft/src/core/client.rs +++ b/async-raft/src/core/client.rs @@ -430,7 +430,7 @@ impl<'a, D: AppData, R: AppDataResponse, N: RaftNetwork, S: RaftStorage if !data_entries.is_empty() { self.core .storage - .replicate_to_state_machine(&data_entries) + .apply_to_state_machine(&data_entries) .await .map_err(|err| self.core.map_fatal_storage_error(err))?; } @@ -445,7 +445,7 @@ impl<'a, D: AppData, R: AppDataResponse, N: RaftNetwork, S: RaftStorage } } // Apply this entry to the state machine and return its data response. - let res = self.core.storage.replicate_to_state_machine(&[entry]).await.map_err(|err| { + let res = self.core.storage.apply_to_state_machine(&[entry]).await.map_err(|err| { if err.downcast_ref::().is_some() { // If this is an instance of the storage impl's shutdown error, then trigger shutdown. self.core.map_fatal_storage_error(err) diff --git a/async-raft/src/storage.rs b/async-raft/src/storage.rs index d0d6365b9..6f7ac2444 100644 --- a/async-raft/src/storage.rs +++ b/async-raft/src/storage.rs @@ -189,7 +189,7 @@ where /// `Raft.client_write` call point. /// /// Errors returned from this method will cause Raft to go into shutdown. - async fn replicate_to_state_machine(&self, entries: &[&Entry]) -> Result>; + async fn apply_to_state_machine(&self, entries: &[&Entry]) -> Result>; /// Perform log compaction, returning a handle to the generated snapshot. /// diff --git a/memstore/src/lib.rs b/memstore/src/lib.rs index 24059111b..092d3f5b6 100644 --- a/memstore/src/lib.rs +++ b/memstore/src/lib.rs @@ -282,7 +282,7 @@ impl RaftStorage for MemStore { } #[tracing::instrument(level = "trace", skip(self, entries))] - async fn replicate_to_state_machine(&self, entries: &[&Entry]) -> Result> { + async fn apply_to_state_machine(&self, entries: &[&Entry]) -> Result> { let mut sm = self.sm.write().await; let mut res = Vec::with_capacity(entries.len()); diff --git a/memstore/src/test.rs b/memstore/src/test.rs index 2a0cf6370..c9b6e9559 100644 --- a/memstore/src/test.rs +++ b/memstore/src/test.rs @@ -270,7 +270,7 @@ async fn test_apply_entry_to_state_machine() -> Result<()> { }, }), }; - store.replicate_to_state_machine(&[&entry]).await?; + store.apply_to_state_machine(&[&entry]).await?; let sm = store.get_state_machine().await; assert_eq!( @@ -326,7 +326,7 @@ async fn test_replicate_to_state_machine() -> Result<()> { }) .collect::>(); - store.replicate_to_state_machine(&entries.iter().collect::>()).await?; + store.apply_to_state_machine(&entries.iter().collect::>()).await?; let sm = store.get_state_machine().await; assert_eq!(