-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to create graph dynamically #1065
Conversation
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
@@ -69,6 +78,17 @@ public void start() throws IOException { | |||
this.calcMaxWriteThreads(); | |||
} | |||
|
|||
private void fillGraphsOption(String graphsDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to graph manager
hugegraph-api/src/main/java/com/baidu/hugegraph/server/RestServer.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/config/ServerOptions.java
Outdated
Show resolved
Hide resolved
import com.baidu.hugegraph.util.E; | ||
import com.baidu.hugegraph.util.Log; | ||
|
||
public class InitStore { | ||
|
||
private static final Logger LOG = Log.logger(InitStore.class); | ||
|
||
private static final String GRAPHS = ServerOptions.GRAPHS.name(); | ||
private static final String GRAPHS = "graphs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to ConfigUtil
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
@@ -88,6 +96,17 @@ public void loadGraphs(final Map<String, String> graphConfs) { | |||
} | |||
} | |||
|
|||
public HugeGraph createGraph(HugeConfig config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure auth permission: write graph
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/ContextGremlinServer.java
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
@Timed | ||
@Path("{name}") | ||
@Produces(APPLICATION_JSON_WITH_CHARSET) | ||
@RolesAllowed({"admin"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep owner
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
eb6230e
to
80ad81d
Compare
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/ContextGremlinServer.java
Outdated
Show resolved
Hide resolved
|
||
HugeGraphServer server = new HugeGraphServer(args[0], args[1]); | ||
Runtime.getRuntime().addShutdownHook(new Thread(() -> { | ||
LOG.info("HugeGraphServer stopping"); | ||
server.stop(); | ||
LOG.info("HugeGraphServer stopped"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, just feel the logs are a bit redundant
hugegraph-dist/src/main/java/com/baidu/hugegraph/dist/HugeGremlinServer.java
Show resolved
Hide resolved
2d8c4fe
to
b2f2a5c
Compare
api test error:
|
233997f
to
40647c1
Compare
cassandra:
postgre:
|
40647c1
to
38bc15b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1065 +/- ##
============================================
- Coverage 66.77% 66.62% -0.15%
- Complexity 7063 7092 +29
============================================
Files 420 423 +3
Lines 34726 34953 +227
Branches 4822 4844 +22
============================================
+ Hits 23187 23289 +102
- Misses 9196 9307 +111
- Partials 2343 2357 +14
Continue to review full report at Codecov.
|
38bc15b
to
46b17b0
Compare
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
// but it's not easy to check here | ||
String backend = config.get(CoreOptions.BACKEND); | ||
if (backend.equalsIgnoreCase("rocksdb")) { | ||
// TODO: should check data path... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem same data path is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same data path is not ok
hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java
Outdated
Show resolved
Hide resolved
"The graph name '%s' has existed", name); | ||
|
||
PropertiesConfiguration propConfig = this.buildConfig(configText); | ||
HugeConfig config = new HugeConfig(propConfig, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor was defined in hugegraph-common 1.7.10, it's not yet published to the maven central repository.
289ec6c
to
6f5b3c0
Compare
@@ -57,8 +57,8 @@ check_port "$REST_SERVER_URL" | |||
|
|||
echo "Starting HugeGraphServer..." | |||
|
|||
"$BIN"/hugegraph-server.sh "$CONF"/gremlin-server.yaml "$CONF"/rest-server.properties \ | |||
"$OPEN_SECURITY_CHECK" "$USER_OPTION" "$GC_OPTION" >>"$LOGS/hugegraph-server.log" 2>&1 & | |||
${BIN}/hugegraph-server.sh ${CONF}/gremlin-server.yaml ${CONF}/rest-server.properties \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir -p ${LOGS}
6f5b3c0
to
221aaad
Compare
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
Implement #165 Change-Id: I03d3e606d6292acec46a7725094c05fe84a6c9cd
Change-Id: I5626be6a0c56074c51339283bf6f6e40914ae56b
Change-Id: I3816cdd3f2ab41f8976256956dd7dbb5fa6bab89
Change-Id: I276bf797a7cd601aaf6c9de1a5148cf05fba9b7d
Change-Id: I0a7f08454be5313478ecc0596731a6bc5f7dec98
Change-Id: I36e8815dd7d1ecac5615dd6a8638ff5ad13414d2
Change-Id: I57ca9ed3db38c77189714840de24b6c5e5e78ad1
Change-Id: Iedc438f6dee08e48dce2868e69555aaf0c058401
Change-Id: I08898184d6bc0323876dfb4a7398b7fafd43f8db
35aea43
to
3507850
Compare
@Consumes(MediaType.TEXT_PLAIN) | ||
@Produces(APPLICATION_JSON_WITH_CHARSET) | ||
@RolesAllowed({"admin", "$owner=$name"}) | ||
public Object manage(@Context GraphManager manager, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add delete method and move clone to create
Change-Id: I4c0220a2f22163037449a6cb829756ad78f7b942
LOG.debug("Create graph {} with config options '{}'", name, configText); | ||
HugeGraph graph = manager.createGraph(name, configText); | ||
HugeGraph graph; | ||
if (clone != null && clone.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "!clone.isEmpty()"?
return graph; | ||
} | ||
|
||
private PropertiesConfiguration buildConfig(String configText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check configText not null? and seems empty string is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test in client side
Implement #165
Change-Id: I03d3e606d6292acec46a7725094c05fe84a6c9cd