File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -3036,4 +3036,36 @@ 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
+ pub fn is_recent_active ( & self , id : u64 ) -> bool {
3042
+ if let Some ( pr) = self . prs ( ) . get ( id) {
3043
+ if pr. recent_active {
3044
+ return true ;
3045
+ }
3046
+ }
3047
+ false
3048
+ }
3049
+
3050
+ /// Get the next idx of peer.
3051
+ #[ inline]
3052
+ pub fn get_next_idx ( & self , id : u64 ) -> Option < u64 > {
3053
+ self . prs ( ) . get ( id) . map ( |pr| pr. next_idx )
3054
+ }
3055
+
3056
+ /// Get the matched of peer.
3057
+ #[ inline]
3058
+ pub fn get_matched ( & self , id : u64 ) -> Option < u64 > {
3059
+ self . prs ( ) . get ( id) . map ( |pr| pr. matched )
3060
+ }
3061
+
3062
+ /// Determine whether a progress is in Replicate state.
3063
+ pub fn is_replicate_state ( & self , id : u64 ) -> bool {
3064
+ if let Some ( pr) = self . prs ( ) . get ( id) {
3065
+ if pr. is_replicate_state ( ) {
3066
+ return true ;
3067
+ }
3068
+ }
3069
+ false
3070
+ }
3039
3071
}
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_replicate_state ( & 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