@@ -7,24 +7,23 @@ use crate::raft::AppendEntriesResponse;
7
7
use crate :: raft:: Entry ;
8
8
use crate :: raft:: EntryPayload ;
9
9
use crate :: raft_types:: LogIdOptionExt ;
10
- use crate :: AppData ;
11
- use crate :: AppDataResponse ;
12
10
use crate :: EffectiveMembership ;
13
11
use crate :: LogId ;
14
12
use crate :: MessageSummary ;
13
+ use crate :: RaftConfig ;
15
14
use crate :: RaftNetworkFactory ;
16
15
use crate :: RaftStorage ;
17
16
use crate :: StorageError ;
18
17
use crate :: Update ;
19
18
20
- impl < D : AppData , R : AppDataResponse , N : RaftNetworkFactory < D > , S : RaftStorage < D , R > > RaftCore < D , R , N , S > {
19
+ impl < C : RaftConfig , N : RaftNetworkFactory < C > , S : RaftStorage < C > > RaftCore < C , N , S > {
21
20
/// An RPC invoked by the leader to replicate log entries (§5.3); also used as heartbeat (§5.2).
22
21
///
23
22
/// See `receiver implementation: AppendEntries RPC` in raft-essentials.md in this repo.
24
23
#[ tracing:: instrument( level = "debug" , skip( self , req) ) ]
25
24
pub ( super ) async fn handle_append_entries_request (
26
25
& mut self ,
27
- req : AppendEntriesRequest < D > ,
26
+ req : AppendEntriesRequest < C > ,
28
27
) -> Result < AppendEntriesResponse , AppendEntriesError > {
29
28
tracing:: debug!( last_log_id=?self . last_log_id, ?self . last_applied, msg=%req. summary( ) , "handle_append_entries_request" ) ;
30
29
@@ -134,10 +133,10 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetworkFactory<D>, S: RaftStorage<D,
134
133
/// R5 2 4 4
135
134
/// ```
136
135
///
137
- /// If log 5 is committed by R1, and log 3 is not removed, R5 in future could become a new leader and overrides log
136
+ /// If log 5 is committed by R1, and log 3 is not removeC5 in future could become a new leader and overrides log
138
137
/// 5 on R3.
139
138
#[ tracing:: instrument( level="trace" , skip( self , msg_entries) , fields( msg_entries=%msg_entries. summary( ) ) ) ]
140
- async fn find_and_delete_conflict_logs ( & mut self , msg_entries : & [ Entry < D > ] ) -> Result < ( ) , StorageError > {
139
+ async fn find_and_delete_conflict_logs ( & mut self , msg_entries : & [ Entry < C > ] ) -> Result < ( ) , StorageError > {
141
140
// all msg_entries are inconsistent logs
142
141
143
142
tracing:: debug!( msg_entries=%msg_entries. summary( ) , "try to delete_inconsistent_log" ) ;
@@ -172,7 +171,7 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetworkFactory<D>, S: RaftStorage<D,
172
171
async fn append_apply_log_entries (
173
172
& mut self ,
174
173
prev_log_id : Option < LogId > ,
175
- entries : & [ Entry < D > ] ,
174
+ entries : & [ Entry < C > ] ,
176
175
committed : Option < LogId > ,
177
176
) -> Result < AppendEntriesResponse , StorageError > {
178
177
let mismatched = self . does_log_id_match ( prev_log_id) . await ?;
@@ -239,8 +238,8 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetworkFactory<D>, S: RaftStorage<D,
239
238
/// Filter them out.
240
239
pub async fn skip_matching_entries < ' s , ' e > (
241
240
& ' s mut self ,
242
- entries : & ' e [ Entry < D > ] ,
243
- ) -> Result < ( usize , & ' e [ Entry < D > ] ) , StorageError > {
241
+ entries : & ' e [ Entry < C > ] ,
242
+ ) -> Result < ( usize , & ' e [ Entry < C > ] ) , StorageError > {
244
243
let l = entries. len ( ) ;
245
244
246
245
for i in 0 ..l {
@@ -307,7 +306,7 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetworkFactory<D>, S: RaftStorage<D,
307
306
/// Configuration changes are also detected and applied here. See `configuration changes`
308
307
/// in the raft-essentials.md in this repo.
309
308
#[ tracing:: instrument( level = "trace" , skip( self , entries) , fields( entries=%entries. summary( ) ) ) ]
310
- async fn append_log_entries ( & mut self , entries : & [ Entry < D > ] ) -> Result < ( ) , StorageError > {
309
+ async fn append_log_entries ( & mut self , entries : & [ Entry < C > ] ) -> Result < ( ) , StorageError > {
311
310
if entries. is_empty ( ) {
312
311
return Ok ( ( ) ) ;
313
312
}
0 commit comments