-
Notifications
You must be signed in to change notification settings - Fork 580
optimize(api): disable GraphSpaceAPI and ManagerAPI in standalone mode #2966
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
base: master
Are you sure you want to change the base?
Changes from all commits
384799d
df94447
cae50d1
e29d967
68ed7f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,7 @@ public class GraphSpaceAPI extends API { | |
| @Produces(APPLICATION_JSON_WITH_CHARSET) | ||
| public Object list(@Context GraphManager manager, | ||
| @Context SecurityContext sc) { | ||
| checkPdModeEnabled(manager); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Set<String> spaces = manager.graphSpaces(); | ||
| return ImmutableMap.of("graphSpaces", spaces); | ||
| } | ||
|
|
@@ -86,6 +87,7 @@ public Object list(@Context GraphManager manager, | |
| @Produces(APPLICATION_JSON_WITH_CHARSET) | ||
| public Object get(@Context GraphManager manager, | ||
| @PathParam("graphspace") String graphSpace) { | ||
| checkPdModeEnabled(manager); | ||
| manager.getSpaceStorage(graphSpace); | ||
| GraphSpace gs = space(manager, graphSpace); | ||
|
|
||
|
|
@@ -155,7 +157,7 @@ public Object listProfile(@Context GraphManager manager, | |
| @RolesAllowed({"admin"}) | ||
| public String create(@Context GraphManager manager, | ||
| JsonGraphSpace jsonGraphSpace) { | ||
|
|
||
| checkPdModeEnabled(manager); | ||
| jsonGraphSpace.checkCreate(false); | ||
|
|
||
| String creator = HugeGraphAuthProxy.username(); | ||
|
|
@@ -186,7 +188,7 @@ public boolean isPrefix(Map<String, Object> profile, String prefix) { | |
| public Map<String, Object> manage(@Context GraphManager manager, | ||
| @PathParam("name") String name, | ||
| Map<String, Object> actionMap) { | ||
|
|
||
| checkPdModeEnabled(manager); | ||
| E.checkArgument(actionMap != null && actionMap.size() == 2 && | ||
| actionMap.containsKey(GRAPH_SPACE_ACTION), | ||
| "Invalid request body '%s'", actionMap); | ||
|
|
@@ -315,6 +317,7 @@ public Map<String, Object> manage(@Context GraphManager manager, | |
| @RolesAllowed({"admin"}) | ||
| public void delete(@Context GraphManager manager, | ||
| @PathParam("name") String name) { | ||
| checkPdModeEnabled(manager); | ||
| manager.dropGraphSpace(name); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -280,6 +280,10 @@ private boolean usePD() { | |||||
| return this.PDExist; | ||||||
| } | ||||||
|
|
||||||
| public boolean isUsePD() { | ||||||
| return this.PDExist; | ||||||
|
||||||
| return this.PDExist; | |
| return this.usePD(); |
Copilot
AI
Mar 10, 2026
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.
The private usePD() method and the newly added public isUsePD() method have identical implementations. The private method should be removed or replaced by delegating to the public one to avoid duplicated logic.
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.
HugeExceptionis a general internal exception and will typically be mapped to an HTTP 500 response, not 400 as intended and as tested. The tests assert HTTP 400 (assertResponseStatus(400, r)), but usingHugeExceptiondirectly will likely result in a 500. You should throw the appropriate exception type that maps to HTTP 400 (e.g.,IllegalArgumentExceptionor aBadRequestException), or use an existing API-level exception that carries the desired status code.