Skip to content

Commit ac4bf4b

Browse files
committed
change: InitialState: rename last_applied_log to last_applied
1 parent f383db7 commit ac4bf4b

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

async-raft/src/core/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>> Ra
185185
self.current_term = state.hard_state.current_term;
186186
self.voted_for = state.hard_state.voted_for;
187187
self.membership = state.membership;
188-
self.last_applied = state.last_applied_log;
188+
self.last_applied = state.last_applied;
189189
// NOTE: this is repeated here for clarity. It is unsafe to initialize the node's commit
190190
// index to any other value. The commit index must be determined by a leader after
191191
// successfully committing a new log to the cluster.

async-raft/src/storage.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ pub struct InitialState {
6363
pub last_log_id: LogId,
6464

6565
/// The LogId of the last log applied to the state machine.
66-
pub last_applied_log: LogId,
66+
pub last_applied: LogId,
67+
6768
/// The saved hard state of the node.
6869
pub hard_state: HardState,
70+
6971
/// The latest cluster membership configuration found in the log, else a new initial
7072
/// membership config consisting only of this node's ID.
7173
pub membership: MembershipConfig,
@@ -79,7 +81,7 @@ impl InitialState {
7981
pub fn new_initial(id: NodeId) -> Self {
8082
Self {
8183
last_log_id: LogId { term: 0, index: 0 },
82-
last_applied_log: LogId { term: 0, index: 0 },
84+
last_applied: LogId { term: 0, index: 0 },
8385
hard_state: HardState {
8486
current_term: 0,
8587
voted_for: None,

memstore/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ impl RaftStorage<ClientRequest, ClientResponse> for MemStore {
593593

594594
Ok(InitialState {
595595
last_log_id,
596-
last_applied_log,
596+
last_applied: last_applied_log,
597597
hard_state: inner.clone(),
598598
membership,
599599
})

memstore/src/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ where
244244
"unexpected default value for last log"
245245
);
246246
assert_eq!(
247-
initial.last_applied_log,
247+
initial.last_applied,
248248
LogId { term: 0, index: 0 },
249249
"unexpected value for last applied log"
250250
);
@@ -290,7 +290,7 @@ where
290290
"state machine has higher log"
291291
);
292292
assert_eq!(
293-
initial.last_applied_log,
293+
initial.last_applied,
294294
LogId { term: 3, index: 1 },
295295
"unexpected value for last applied log"
296296
);

0 commit comments

Comments
 (0)