use of com.baidu.hugegraph.config.HugeConfig in project incubator-hugegraph by apache.
the class StandardHugeGraph method cloneConfig.
@Override
public HugeConfig cloneConfig(String newGraph) {
HugeConfig config = (HugeConfig) this.configuration().clone();
this.storeProvider.onCloneConfig(config, newGraph);
return config;
}
use of com.baidu.hugegraph.config.HugeConfig in project incubator-hugegraph by apache.
the class SnowflakeIdGenerator method init.
public static SnowflakeIdGenerator init(HugeGraphParams graph) {
String graphName = graph.name();
SnowflakeIdGenerator generator = INSTANCES.get(graphName);
if (generator == null) {
synchronized (INSTANCES) {
if (!INSTANCES.containsKey(graphName)) {
HugeConfig conf = graph.configuration();
INSTANCES.put(graphName, new SnowflakeIdGenerator(conf));
}
generator = INSTANCES.get(graphName);
assert generator != null;
}
}
return generator;
}
use of com.baidu.hugegraph.config.HugeConfig in project incubator-hugegraph by apache.
the class BackendProviderFactory method open.
public static BackendStoreProvider open(HugeGraphParams params) {
HugeConfig config = params.configuration();
String backend = config.get(CoreOptions.BACKEND).toLowerCase();
String graph = config.get(CoreOptions.STORE);
boolean raftMode = config.get(CoreOptions.RAFT_MODE);
BackendStoreProvider provider = newProvider(config);
if (raftMode) {
LOG.info("Opening backend store '{}' in raft mode for graph '{}'", backend, graph);
provider = new RaftBackendStoreProvider(provider, params);
}
provider.open(graph);
return provider;
}
use of com.baidu.hugegraph.config.HugeConfig in project incubator-hugegraph by apache.
the class ConfDumper method main.
public static void main(String[] args) throws ConfigurationException, IOException {
E.checkArgument(args.length == 1, "ConfDumper need a config file.");
String input = args[0];
File output = new File(input + ".default");
LOG.info("Input config: {}", input);
LOG.info("Output config: {}", output.getPath());
RegisterUtil.registerBackends();
RegisterUtil.registerServer();
HugeConfig config = new HugeConfig(input);
for (String name : new TreeSet<>(OptionSpace.keys())) {
TypedOption<?, ?> option = OptionSpace.get(name);
writeOption(output, option, config.get(option));
}
}
use of com.baidu.hugegraph.config.HugeConfig in project incubator-hugegraph by apache.
the class InitStore method initGraph.
private static void initGraph(String configPath) throws Exception {
LOG.info("Init graph with config file: {}", configPath);
HugeConfig config = new HugeConfig(configPath);
// Forced set RAFT_MODE to false when initializing backend
config.setProperty(CoreOptions.RAFT_MODE.name(), "false");
HugeGraph graph = (HugeGraph) GraphFactory.open(config);
BackendStoreSystemInfo sysInfo = graph.backendStoreSystemInfo();
try {
if (sysInfo.exists()) {
LOG.info("Skip init-store due to the backend store of '{}' " + "had been initialized", graph.name());
sysInfo.checkVersion();
} else {
initBackend(graph);
}
} finally {
graph.close();
}
}
Aggregations