@@ -19,6 +19,7 @@ use async_raft::storage::HardState;
19
19
use async_raft:: storage:: InitialState ;
20
20
use async_raft:: AppData ;
21
21
use async_raft:: AppDataResponse ;
22
+ use async_raft:: LogId ;
22
23
use async_raft:: NodeId ;
23
24
use async_raft:: RaftStorage ;
24
25
use async_raft:: SnapshotId ;
@@ -66,10 +67,9 @@ pub enum ShutdownError {
66
67
/// The application snapshot type which the `MemStore` works with.
67
68
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
68
69
pub struct MemStoreSnapshot {
69
- /// The last index covered by this snapshot.
70
- pub index : u64 ,
71
- /// The term of the last index covered by this snapshot.
72
- pub term : u64 ,
70
+ /// The last log covered by this snapshot.
71
+ pub last_log_id : LogId ,
72
+
73
73
/// The last memberhsip config included in this snapshot.
74
74
pub membership : MembershipConfig ,
75
75
@@ -339,8 +339,10 @@ impl RaftStorage<ClientRequest, ClientResponse> for MemStore {
339
339
340
340
snapshot_id = format ! ( "{}-{}-{}" , term, last_applied_log, snapshot_idx) ;
341
341
let snapshot = MemStoreSnapshot {
342
- index : last_applied_log,
343
- term,
342
+ last_log_id : LogId {
343
+ term,
344
+ index : last_applied_log,
345
+ } ,
344
346
snapshot_id : snapshot_id. clone ( ) ,
345
347
membership : membership_config. clone ( ) ,
346
348
data,
@@ -433,7 +435,7 @@ impl RaftStorage<ClientRequest, ClientResponse> for MemStore {
433
435
Some ( snapshot) => {
434
436
let reader = serde_json:: to_vec ( & snapshot) ?;
435
437
Ok ( Some ( CurrentSnapshotData {
436
- last_log_id : ( snapshot. term , snapshot . index ) . into ( ) ,
438
+ last_log_id : snapshot. last_log_id ,
437
439
membership : snapshot. membership . clone ( ) ,
438
440
snapshot_id : snapshot. snapshot_id . clone ( ) ,
439
441
snapshot : Box :: new ( Cursor :: new ( reader) ) ,
0 commit comments