File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -3036,4 +3036,28 @@ impl<T: Storage> Raft<T> {
3036
3036
pr. ins . set_cap ( cap) ;
3037
3037
}
3038
3038
}
3039
+
3040
+ /// Whether this RawNode is active recently.
3041
+ #[ inline]
3042
+ pub fn is_recent_active ( & self , id : u64 ) -> bool {
3043
+ self . prs ( ) . get ( id) . map_or ( false , |pr| pr. recent_active )
3044
+ }
3045
+
3046
+ /// Get the next idx of peer.
3047
+ #[ inline]
3048
+ pub fn get_next_idx ( & self , id : u64 ) -> Option < u64 > {
3049
+ self . prs ( ) . get ( id) . map ( |pr| pr. next_idx )
3050
+ }
3051
+
3052
+ /// Get the matched of peer.
3053
+ #[ inline]
3054
+ pub fn get_matched ( & self , id : u64 ) -> Option < u64 > {
3055
+ self . prs ( ) . get ( id) . map ( |pr| pr. matched )
3056
+ }
3057
+
3058
+ /// Determine whether a progress is in Replicate state.
3059
+ #[ inline]
3060
+ pub fn is_replicating ( & self , id : u64 ) -> bool {
3061
+ self . prs ( ) . get ( id) . map_or ( false , |pr| pr. is_replicating ( ) )
3062
+ }
3039
3063
}
Original file line number Diff line number Diff line change @@ -203,6 +203,12 @@ impl Progress {
203
203
true
204
204
}
205
205
206
+ /// Determine whether progress is in the Replicate state;
207
+ #[ inline]
208
+ pub fn is_replicating ( & self ) -> bool {
209
+ self . state == ProgressState :: Replicate
210
+ }
211
+
206
212
/// Determine whether progress is paused.
207
213
#[ inline]
208
214
pub fn is_paused ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments