@@ -12,10 +12,9 @@ use super::RawRpcRequest;
12
12
use crate :: {
13
13
collect_first,
14
14
pd:: PdClient ,
15
- plain_request, plain_response,
16
15
request:: {
17
- plan :: ResponseWithShard , codec :: RequestCodec , Collect , CollectSingle ,
18
- DefaultProcessor , KvRequest , Merge , Process , Shardable , SingleKey ,
16
+ codec :: RequestCodec , plan :: ResponseWithShard , Collect , CollectSingle , DefaultProcessor ,
17
+ KvRequest , Merge , Process , Shardable , SingleKey ,
19
18
} ,
20
19
store:: { store_stream_for_keys, store_stream_for_ranges, RegionStore } ,
21
20
transaction:: HasLocks ,
@@ -31,20 +30,7 @@ pub fn new_raw_get_request(key: Vec<u8>, cf: Option<ColumnFamily>) -> kvrpcpb::R
31
30
req
32
31
}
33
32
34
- impl < C : RequestCodec > KvRequest < C > for kvrpcpb:: RawGetRequest {
35
- type Response = kvrpcpb:: RawGetResponse ;
36
-
37
- fn encode_request ( & self , codec : & C ) -> Cow < Self > {
38
- plain_request ! ( self , codec) ;
39
- todo ! ( )
40
- }
41
-
42
- fn decode_response ( & self , codec : & C , resp : Self :: Response ) -> Result < Self :: Response > {
43
- plain_response ! ( resp, codec) ;
44
- todo ! ( )
45
- }
46
- }
47
-
33
+ kv_request_with_key ! ( kvrpcpb:: RawGetRequest , kvrpcpb:: RawGetResponse ) ;
48
34
shardable_key ! ( kvrpcpb:: RawGetRequest ) ;
49
35
collect_first ! ( kvrpcpb:: RawGetResponse ) ;
50
36
@@ -78,20 +64,7 @@ pub fn new_raw_batch_get_request(
78
64
req
79
65
}
80
66
81
- impl < C : RequestCodec > KvRequest < C > for kvrpcpb:: RawBatchGetRequest {
82
- type Response = kvrpcpb:: RawBatchGetResponse ;
83
-
84
- fn encode_request ( & self , codec : & C ) -> Cow < Self > {
85
- plain_request ! ( self , codec) ;
86
- todo ! ( )
87
- }
88
-
89
- fn decode_response ( & self , codec : & C , resp : Self :: Response ) -> Result < Self :: Response > {
90
- plain_response ! ( resp, codec) ;
91
- todo ! ( )
92
- }
93
- }
94
-
67
+ kv_request_with_key ! ( kvrpcpb:: RawBatchGetRequest , kvrpcpb:: RawBatchGetResponse ) ;
95
68
shardable_keys ! ( kvrpcpb:: RawBatchGetRequest ) ;
96
69
97
70
impl Merge < kvrpcpb:: RawBatchGetResponse > for Collect {
@@ -120,22 +93,10 @@ pub fn new_raw_put_request(
120
93
req
121
94
}
122
95
123
- impl < C : RequestCodec > KvRequest < C > for kvrpcpb:: RawPutRequest {
124
- type Response = kvrpcpb:: RawPutResponse ;
125
-
126
- fn encode_request ( & self , codec : & C ) -> Cow < Self > {
127
- plain_request ! ( self , codec) ;
128
- todo ! ( )
129
- }
130
-
131
- fn decode_response ( & self , codec : & C , resp : Self :: Response ) -> Result < Self :: Response > {
132
- plain_response ! ( resp, codec) ;
133
- todo ! ( )
134
- }
135
- }
136
-
96
+ kv_request_with_key ! ( kvrpcpb:: RawPutRequest , kvrpcpb:: RawPutResponse ) ;
137
97
shardable_key ! ( kvrpcpb:: RawPutRequest ) ;
138
98
collect_first ! ( kvrpcpb:: RawPutResponse ) ;
99
+
139
100
impl SingleKey for kvrpcpb:: RawPutRequest {
140
101
fn key ( & self ) -> & Vec < u8 > {
141
102
& self . key
0 commit comments