Skip to content

Commit

Permalink
fix import style
Browse files Browse the repository at this point in the history
  • Loading branch information
imbajin committed Mar 9, 2023
1 parent 5e3939e commit d475b22
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@
import java.util.concurrent.ThreadPoolExecutor;

import org.apache.commons.io.FileUtils;
import org.apache.hugegraph.backend.store.raft.rpc.ListPeersProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.RpcForwarder;
import org.apache.hugegraph.backend.store.raft.compress.CompressStrategyManager;
import org.slf4j.Logger;

import com.alipay.sofa.jraft.NodeManager;
import com.alipay.sofa.jraft.conf.Configuration;
import com.alipay.sofa.jraft.entity.PeerId;
import com.alipay.sofa.jraft.option.NodeOptions;
import com.alipay.sofa.jraft.option.RaftOptions;
import com.alipay.sofa.jraft.option.ReadOnlyOption;
import com.alipay.sofa.jraft.rpc.RaftRpcServerFactory;
import com.alipay.sofa.jraft.rpc.RpcServer;
import com.alipay.sofa.jraft.rpc.impl.BoltRpcServer;
import com.alipay.sofa.jraft.util.NamedThreadFactory;
import com.alipay.sofa.jraft.util.ThreadPoolUtil;
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraphParams;
import org.apache.hugegraph.backend.cache.Cache;
Expand All @@ -55,11 +39,14 @@
import org.apache.hugegraph.backend.store.BackendMutation;
import org.apache.hugegraph.backend.store.BackendStore;
import org.apache.hugegraph.backend.store.BackendStoreProvider;
import org.apache.hugegraph.backend.store.raft.compress.CompressStrategyManager;
import org.apache.hugegraph.backend.store.raft.rpc.AddPeerProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.ListPeersProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType;
import org.apache.hugegraph.backend.store.raft.rpc.RemovePeerProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.RpcForwarder;
import org.apache.hugegraph.backend.store.raft.rpc.SetLeaderProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.StoreCommandProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.AddPeerProcessor;
import org.apache.hugegraph.backend.store.raft.rpc.RemovePeerProcessor;
import org.apache.hugegraph.config.CoreOptions;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.event.EventHub;
Expand All @@ -69,6 +56,19 @@
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Events;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;

import com.alipay.sofa.jraft.NodeManager;
import com.alipay.sofa.jraft.conf.Configuration;
import com.alipay.sofa.jraft.entity.PeerId;
import com.alipay.sofa.jraft.option.NodeOptions;
import com.alipay.sofa.jraft.option.RaftOptions;
import com.alipay.sofa.jraft.option.ReadOnlyOption;
import com.alipay.sofa.jraft.rpc.RaftRpcServerFactory;
import com.alipay.sofa.jraft.rpc.RpcServer;
import com.alipay.sofa.jraft.rpc.impl.BoltRpcServer;
import com.alipay.sofa.jraft.util.NamedThreadFactory;
import com.alipay.sofa.jraft.util.ThreadPoolUtil;

public final class RaftContext {

Expand Down Expand Up @@ -114,7 +114,7 @@ public RaftContext(HugeGraphParams params) {
HugeConfig config = params.configuration();

/*
* NOTE: `raft.group_peers` option is transfered from ServerConfig
* NOTE: `raft.group_peers` option is transferred from ServerConfig
* to CoreConfig, since it's shared by all graphs.
*/
String groupPeersString = this.config().getString("raft.group_peers");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hugegraph.backend.store.raft.compress.CompressStrategyManager;
import org.apache.hugegraph.testutil.Whitebox;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;

import com.alipay.sofa.jraft.Closure;
Expand All @@ -40,12 +44,6 @@
import com.alipay.sofa.jraft.storage.snapshot.SnapshotReader;
import com.alipay.sofa.jraft.storage.snapshot.SnapshotWriter;
import com.alipay.sofa.jraft.util.CRC64;

import org.apache.hugegraph.testutil.Whitebox;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.InsertionOrderUtil;
import org.apache.hugegraph.util.Log;

import com.google.protobuf.ByteString;

public class StoreSnapshotFile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

public interface CompressStrategy {

void compressZip(String rootDir, String sourceDir, String outputZipFile, Checksum checksum)
throws Throwable;
void compressZip(String rootDir, String sourceDir, String outputZipFile,
Checksum checksum) throws Throwable;

void decompressZip(String sourceZipFile, String outputDir, Checksum checksum) throws Throwable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public static void init(final HugeConfig config) {
// add parallel compress strategy
if (compressStrategies[PARALLEL_STRATEGY] == null) {
CompressStrategy compressStrategy = new ParallelCompressStrategy(
config.get(CoreOptions.RAFT_SNAPSHOT_COMPRESS_THREADS),
config.get(CoreOptions.RAFT_SNAPSHOT_DECOMPRESS_THREADS));
config.get(CoreOptions.RAFT_SNAPSHOT_COMPRESS_THREADS),
config.get(CoreOptions.RAFT_SNAPSHOT_DECOMPRESS_THREADS));
CompressStrategyManager.addCompressStrategy(
CompressStrategyManager.PARALLEL_STRATEGY, compressStrategy);
CompressStrategyManager.PARALLEL_STRATEGY, compressStrategy);
DEFAULT_STRATEGY = PARALLEL_STRATEGY;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public void compressZip(String rootDir, String sourceDir, String outputZipFile,
}

@Override
public void decompressZip(String sourceZipFile, String outputDir, Checksum checksum)
throws Throwable {
public void decompressZip(String sourceZipFile, String outputDir,
Checksum checksum) throws Throwable {
LOG.info("Start to decompress snapshot in parallel mode");
ExecutorService decompressExecutor =
newFixedPool(decompressThreads, decompressThreads,
Expand Down Expand Up @@ -166,8 +166,7 @@ private void compressDirectoryToZipFile(File dir, ZipArchiveScatterOutputStream
addEntry(sourceDir, dir, scatterOutput, method);
return;
}
File[] files = Requires.requireNonNull(Objects.requireNonNull(dir.listFiles()),
"files");
File[] files = Requires.requireNonNull(Objects.requireNonNull(dir.listFiles()), "files");
for (File file : files) {
String child = Paths.get(sourceDir, file.getName()).toString();
if (file.isDirectory()) {
Expand Down Expand Up @@ -199,8 +198,8 @@ private void addEntry(String filePath, File file,
/**
* Unzip the archive entry to targetDir
*/
private void unZipFile(ZipFile zipFile, ZipArchiveEntry entry, String targetDir)
throws Exception {
private void unZipFile(ZipFile zipFile, ZipArchiveEntry entry,
String targetDir) throws Exception {
File targetFile = new File(Paths.get(targetDir, entry.getName()).toString());
if (!targetFile.toPath().normalize().startsWith(targetDir)) {
throw new IOException(String.format("Bad entry: %s", entry.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void compressZip(String rootDir, String sourceDir, String outputZipFile,
}

@Override
public void decompressZip(String sourceZipFile, String outputDir, Checksum checksum)
throws Throwable {
public void decompressZip(String sourceZipFile, String outputDir,
Checksum checksum) throws Throwable {
LOG.info("Start to decompress snapshot in serial strategy");
CompressUtil.decompressZip(sourceZipFile, outputDir, checksum);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.apache.hugegraph.config.OptionChecker.rangeInt;

import org.apache.hugegraph.backend.query.Query;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.type.define.CollectionType;
import org.apache.hugegraph.util.Bytes;

Expand Down

0 comments on commit d475b22

Please sign in to comment.