|
3 | 3 | use std::sync::{Arc, RwLock};
|
4 | 4 |
|
5 | 5 | use engine_traits::{KvEngine, RaftEngine};
|
6 |
| -use futures::Future; |
| 6 | +use futures::future::{FutureExt, BoxFuture}; |
7 | 7 | use kvproto::{
|
8 | 8 | raft_cmdpb::{RaftCmdRequest, RaftCmdResponse},
|
9 | 9 | raft_serverpb::RaftMessage,
|
@@ -64,30 +64,30 @@ impl<C: Transport> Transport for SimulateTransport<C> {
|
64 | 64 | }
|
65 | 65 | }
|
66 | 66 |
|
67 |
| -pub trait SnapshotRouter<E: KvEngine> { |
| 67 | +pub trait SnapshotRouter<EK: KvEngine> { |
68 | 68 | fn snapshot(
|
69 | 69 | &mut self,
|
70 | 70 | req: RaftCmdRequest,
|
71 |
| - ) -> impl Future<Output = std::result::Result<RegionSnapshot<E::Snapshot>, RaftCmdResponse>> + Send; |
| 71 | + ) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>>; |
72 | 72 | }
|
73 | 73 |
|
74 | 74 | impl<EK: KvEngine, ER: RaftEngine> SnapshotRouter<EK> for RaftRouter<EK, ER> {
|
75 | 75 | fn snapshot(
|
76 | 76 | &mut self,
|
77 | 77 | req: RaftCmdRequest,
|
78 |
| - ) -> impl Future<Output = std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>> + Send |
| 78 | + ) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>> |
79 | 79 | {
|
80 |
| - self.snapshot(req) |
| 80 | + self.snapshot(req).boxed() |
81 | 81 | }
|
82 | 82 | }
|
83 | 83 |
|
84 |
| -impl<E: KvEngine, C: SnapshotRouter<E>> SnapshotRouter<E> for SimulateTransport<C> { |
| 84 | +impl<EK: KvEngine, C: SnapshotRouter<EK>> SnapshotRouter<EK> for SimulateTransport<C> { |
85 | 85 | fn snapshot(
|
86 | 86 | &mut self,
|
87 | 87 | req: RaftCmdRequest,
|
88 |
| - ) -> impl Future<Output = std::result::Result<RegionSnapshot<E::Snapshot>, RaftCmdResponse>> + Send |
| 88 | + ) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>> |
89 | 89 | {
|
90 |
| - self.ch.snapshot(req) |
| 90 | + self.ch.snapshot(req).boxed() |
91 | 91 | }
|
92 | 92 | }
|
93 | 93 |
|
|
0 commit comments