Skip to content

Commit

Permalink
dump
Browse files Browse the repository at this point in the history
  • Loading branch information
leonchen83 committed Jan 19, 2021
1 parent fdf8283 commit 795a3ce
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.moilioncircle.redis.replicator.io.RedisInputStream;
import com.moilioncircle.redis.replicator.rdb.BaseRdbParser;
import com.moilioncircle.redis.replicator.rdb.DefaultRdbVisitor;
import com.moilioncircle.redis.replicator.rdb.RdbValueVisitor;
import com.moilioncircle.redis.replicator.rdb.datatype.ContextKeyValuePair;
import com.moilioncircle.redis.replicator.rdb.datatype.KeyValuePair;
import com.moilioncircle.redis.replicator.rdb.dump.datatype.DumpKeyValuePair;
Expand Down Expand Up @@ -55,7 +56,8 @@ public DumpRdbVisitor(Replicator replicator) {

/**
* @param replicator the replicator
* @param version dumped version : redis 2.8.x = 6, redis 3.x = 7, redis 4.0.x = 8, -1 means dumped version = rdb version
* @param version dumped version : redis 2.8.x = 6, redis 3.x = 7, redis 4.0.x = 8, redis 5.0+ = 9.
* -1 means dumped version = rdb version
* @since 2.6.0
*/
public DumpRdbVisitor(Replicator replicator, int version) {
Expand All @@ -65,6 +67,15 @@ public DumpRdbVisitor(Replicator replicator, int version) {
public DumpRdbVisitor(Replicator replicator, int version, int size) {
super(replicator, new DumpRdbValueVisitor(replicator, version, size));
}

/**
* @param replicator the replicator
* @param valueVisitor rdb value visitor
* @since 3.5.1
*/
public DumpRdbVisitor(Replicator replicator, RdbValueVisitor valueVisitor) {
super(replicator, valueVisitor);
}

@Override
public Event applyString(RedisInputStream in, int version, ContextKeyValuePair context) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
/*
* Copyright 2016-2017 Leon Chen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.moilioncircle.redis.replicator.rdb.dump;

import com.moilioncircle.redis.replicator.util.ByteBuilder;

import static java.lang.Integer.parseInt;

/**
* @author Leon Chen
*/
public class ByteParser {
public static byte[] toBytes(String str) {
char[] ary = str.toCharArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2016-2017 Leon Chen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.moilioncircle.redis.replicator.rdb.dump;

import static org.junit.Assert.assertArrayEquals;
Expand All @@ -16,6 +32,9 @@
import com.moilioncircle.redis.replicator.rdb.dump.datatype.DumpKeyValuePair;
import com.moilioncircle.redis.replicator.util.Strings;

/**
* @author Leon Chen
*/
public class DumpRdbVisitorTest {
@Test
public void test1() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2016-2017 Leon Chen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.moilioncircle.redis.replicator.rdb.dump.parser;

import com.moilioncircle.redis.replicator.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2016-2017 Leon Chen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.moilioncircle.redis.replicator.rdb.iterable;

import com.moilioncircle.redis.replicator.Configuration;
Expand All @@ -19,6 +35,9 @@
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.fail;

/**
* @author Leon Chen
*/
public class ValueIterableRdbListenerTest {

@Test
Expand Down

0 comments on commit 795a3ce

Please sign in to comment.