• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

leonchen83 / redis-replicator / #2187

07 Jun 2025 09:11AM UTC coverage: 69.535% (-0.5%) from 69.989%
#2187

push

leonchen83
redis-8.0

1 of 123 new or added lines in 13 files covered. (0.81%)

1 existing line in 1 file now uncovered.

6642 of 9552 relevant lines covered (69.54%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.62
/src/main/java/com/moilioncircle/redis/replicator/rdb/skip/SkipRdbVisitor.java
1
/*
2
 * Copyright 2016-2018 Leon Chen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.moilioncircle.redis.replicator.rdb.skip;
18

19
import static com.moilioncircle.redis.replicator.Constants.RDB_OPCODE_FREQ;
20
import static com.moilioncircle.redis.replicator.Constants.RDB_OPCODE_IDLE;
21

22
import java.io.IOException;
23

24
import com.moilioncircle.redis.replicator.Replicator;
25
import com.moilioncircle.redis.replicator.event.Event;
26
import com.moilioncircle.redis.replicator.io.RedisInputStream;
27
import com.moilioncircle.redis.replicator.rdb.DefaultRdbVisitor;
28
import com.moilioncircle.redis.replicator.rdb.RdbValueVisitor;
29
import com.moilioncircle.redis.replicator.rdb.datatype.ContextKeyValuePair;
30
import com.moilioncircle.redis.replicator.rdb.datatype.DB;
31
import com.moilioncircle.redis.replicator.rdb.datatype.Function;
32

33
/**
34
 * @author Leon Chen
35
 * @since 2.4.6
36
 */
37
public class SkipRdbVisitor extends DefaultRdbVisitor {
38

39
    public SkipRdbVisitor(Replicator replicator) {
40
        super(replicator);
1✔
41
    }
1✔
42
    
43
    public SkipRdbVisitor(Replicator replicator, RdbValueVisitor valueVisitor) {
44
        super(replicator, valueVisitor);
×
45
    }
×
46
    
47
    @Override
48
    public Function applyFunction(RedisInputStream in, int version) throws IOException {
49
        valueVisitor.applyFunction(in, version);
×
50
        return null;
×
51
    }
52
    
53
    @Override
54
    public Function applyFunction2(RedisInputStream in, int version) throws IOException {
55
        valueVisitor.applyFunction2(in, version);
×
56
        return null;
×
57
    }
58

59
    @Override
60
    public DB applySelectDB(RedisInputStream in, int version) throws IOException {
61
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
62
        parser.rdbLoadLen();
1✔
63
        return null;
1✔
64
    }
65

66
    @Override
67
    public DB applyResizeDB(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
68
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
69
        parser.rdbLoadLen();
1✔
70
        parser.rdbLoadLen();
1✔
71
        return null;
1✔
72
    }
73

74
    @Override
75
    public Event applyExpireTime(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
76
        SkipRdbParser parser = new SkipRdbParser(in);
×
77
        parser.rdbLoadTime();
×
78
        int type = applyType(in);
×
79
        context.setValueRdbType(type);
×
80
        if (type == RDB_OPCODE_FREQ) {
×
81
            applyFreq(in, version, context);
×
82
        } else if (type == RDB_OPCODE_IDLE) {
×
83
            applyIdle(in, version, context);
×
84
        } else {
85
            rdbLoadObject(in, version, context);
×
86
        }
87
        return null;
×
88
    }
89

90
    @Override
91
    public Event applyExpireTimeMs(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
92
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
93
        parser.rdbLoadMillisecondTime();
1✔
94
        int type = applyType(in);
1✔
95
        context.setValueRdbType(type);
1✔
96
        if (type == RDB_OPCODE_FREQ) {
1✔
97
            applyFreq(in, version, context);
×
98
        } else if (type == RDB_OPCODE_IDLE) {
1✔
99
            applyIdle(in, version, context);
×
100
        } else {
101
            rdbLoadObject(in, version, context);
1✔
102
        }
103
        return null;
1✔
104
    }
105

106
    @Override
107
    public Event applyFreq(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
108
        in.read();
×
109
        int valueType = applyType(in);
×
110
        context.setValueRdbType(valueType);
×
111
        rdbLoadObject(in, version, context);
×
112
        return null;
×
113
    }
114

115
    @Override
116
    public Event applyIdle(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
117
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
118
        parser.rdbLoadLen();
1✔
119
        int valueType = applyType(in);
1✔
120
        context.setValueRdbType(valueType);
1✔
121
        rdbLoadObject(in, version, context);
1✔
122
        return null;
1✔
123
    }
124

125
    @Override
126
    public Event applyAux(RedisInputStream in, int version) throws IOException {
127
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
128
        parser.rdbLoadEncodedStringObject();
1✔
129
        parser.rdbLoadEncodedStringObject();
1✔
130
        return null;
1✔
131
    }
132

133
    @Override
134
    public Event applyModuleAux(RedisInputStream in, int version) throws IOException {
135
        return super.applyModuleAux(in, version);
×
136
    }
137

138
    @Override
139
    public Event applyString(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
140
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
141
        parser.rdbLoadEncodedStringObject();
1✔
142
        valueVisitor.applyString(in, version);
1✔
143
        return null;
1✔
144
    }
145

146
    @Override
147
    public Event applyList(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
148
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
149
        parser.rdbLoadEncodedStringObject();
1✔
150
        valueVisitor.applyList(in, version);
1✔
151
        return null;
1✔
152
    }
153

154
    @Override
155
    public Event applySet(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
156
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
157
        parser.rdbLoadEncodedStringObject();
1✔
158
        valueVisitor.applySet(in, version);
1✔
159
        return null;
1✔
160
    }
161
    
162
    @Override
163
    public Event applySetListPack(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
164
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
165
        parser.rdbLoadEncodedStringObject();
1✔
166
        valueVisitor.applySetListPack(in, version);
1✔
167
        return null;
1✔
168
    }
169

170
    @Override
171
    public Event applyZSet(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
172
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
173
        parser.rdbLoadEncodedStringObject();
1✔
174
        valueVisitor.applyZSet(in, version);
1✔
175
        return null;
1✔
176
    }
177

178
    @Override
179
    public Event applyZSet2(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
180
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
181
        parser.rdbLoadEncodedStringObject();
1✔
182
        valueVisitor.applyZSet2(in, version);
1✔
183
        return null;
1✔
184
    }
185

186
    @Override
187
    public Event applyHash(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
188
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
189
        parser.rdbLoadEncodedStringObject();
1✔
190
        valueVisitor.applyHash(in, version);
1✔
191
        return null;
1✔
192
    }
193

194
    @Override
195
    public Event applyHashZipMap(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
196
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
197
        parser.rdbLoadEncodedStringObject();
1✔
198
        valueVisitor.applyHashZipMap(in, version);
1✔
199
        return null;
1✔
200
    }
201

202
    @Override
203
    public Event applyListZipList(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
204
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
205
        parser.rdbLoadEncodedStringObject();
1✔
206
        valueVisitor.applyListZipList(in, version);
1✔
207
        return null;
1✔
208
    }
209

210
    @Override
211
    public Event applySetIntSet(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
212
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
213
        parser.rdbLoadEncodedStringObject();
1✔
214
        valueVisitor.applySetIntSet(in, version);
1✔
215
        return null;
1✔
216
    }
217

218
    @Override
219
    public Event applyZSetZipList(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
220
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
221
        parser.rdbLoadEncodedStringObject();
1✔
222
        valueVisitor.applyZSetZipList(in, version);
1✔
223
        return null;
1✔
224
    }
225
    
226
    @Override
227
    public Event applyZSetListPack(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
228
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
229
        parser.rdbLoadEncodedStringObject();
1✔
230
        valueVisitor.applyZSetListPack(in, version);
1✔
231
        return null;
1✔
232
    }
233

234
    @Override
235
    public Event applyHashZipList(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
236
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
237
        parser.rdbLoadEncodedStringObject();
1✔
238
        valueVisitor.applyHashZipList(in, version);
1✔
239
        return null;
1✔
240
    }
241
    
242
    @Override
243
    public Event applyHashListPack(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
244
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
245
        parser.rdbLoadEncodedStringObject();
1✔
246
        valueVisitor.applyHashListPack(in, version);
1✔
247
        return null;
1✔
248
    }
249

250
    @Override
251
    public Event applyListQuickList(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
252
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
253
        parser.rdbLoadEncodedStringObject();
1✔
254
        valueVisitor.applyListQuickList(in, version);
1✔
255
        return null;
1✔
256
    }
257

258
    @Override
259
    public Event applyListQuickList2(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
260
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
261
        parser.rdbLoadEncodedStringObject();
1✔
262
        valueVisitor.applyListQuickList2(in, version);
1✔
263
        return null;
1✔
264
    }
265
    
266
    @Override
267
    public Event applyHashMetadata(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException{
NEW
268
        SkipRdbParser parser = new SkipRdbParser(in);
×
NEW
269
        parser.rdbLoadEncodedStringObject();
×
NEW
270
        valueVisitor.applyHashMetadata(in, version);
×
NEW
271
        return null;
×
272
    }
273
    
274
    @Override
275
    public Event applyHashListPackEx(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
NEW
276
        SkipRdbParser parser = new SkipRdbParser(in);
×
NEW
277
        parser.rdbLoadEncodedStringObject();
×
NEW
278
        valueVisitor.applyHashListPackEx(in, version);
×
NEW
279
        return null;
×
280
    }
281
    
282
    @Override
283
    public Event applyModule(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
284
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
285
        parser.rdbLoadEncodedStringObject();
1✔
286
        valueVisitor.applyModule(in, version);
1✔
287
        return null;
1✔
288
    }
289

290
    @Override
291
    public Event applyModule2(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
292
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
293
        parser.rdbLoadEncodedStringObject();
1✔
294
        valueVisitor.applyModule2(in, version);
1✔
295
        return null;
1✔
296
    }
297

298
    @Override
299
    public Event applyStreamListPacks(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
300
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
301
        parser.rdbLoadEncodedStringObject();
1✔
302
        valueVisitor.applyStreamListPacks(in, version);
1✔
303
        return null;
1✔
304
    }
305
    
306
    @Override
307
    public Event applyStreamListPacks2(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
308
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
309
        parser.rdbLoadEncodedStringObject();
1✔
310
        valueVisitor.applyStreamListPacks2(in, version);
1✔
311
        return null;
1✔
312
    }
313
    
314
    @Override
315
    public Event applyStreamListPacks3(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
316
        SkipRdbParser parser = new SkipRdbParser(in);
1✔
317
        parser.rdbLoadEncodedStringObject();
1✔
318
        valueVisitor.applyStreamListPacks3(in, version);
1✔
319
        return null;
1✔
320
    }
321
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc