Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
|
@codecov-ai-reviewer review |
…h operations, and switching capabilities Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
…placeholders Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
…ing features Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
|
你实现的代码有错误, |
|
这个url 是最新的 HugeGraph 1.7.0 API 文档, 请参考这个文档进行实现。 |
…tion - remove incorrect graphspace CRUD APIs Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
已根据 HugeGraph 1.7.0 官方 API 文档修正实现 (commit a1fb46e): 主要修正:
所有实现现在完全符合文档 |
|
这里我贴了完整的 md 源码, 也可以直接作为参考: ---
title: "Graphs API"
linkTitle: "Graphs"
weight: 12
---
### 6.1 Graphs
#### 6.1.1 列出图空间中全部的图
##### Params
**路径参数说明:**
- graphspace: 图空间名称
##### Method & Url
GET http://localhost:8080/graphspaces/DEFAULT/graphs Response Body{
"graphs": [
"hugegraph",
"hugegraph1"
]
}6.1.2 查看某个图的信息Params路径参数说明:
Method & UrlResponse Status200Response Body{
"name": "hugegraph",
"backend": "cassandra"
}6.1.3 清空某个图的全部数据,包括 schema、vertex、edge 和 index 等,该操作需要管理员权限Params路径参数说明:
请求参数说明: 由于清空图是一个比较危险的操作,为避免用户误调用,我们给 API 添加了用于确认的参数:
Method & UrlResponse Status2046.1.4 克隆一个图 (管理员权限)Params路径参数说明:
请求参数说明:
Method & UrlRequest Body (可选)克隆一个非鉴权模式的图(设置 {
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
"backend": "rocksdb",
"serializer": "binary",
"store": "hugegraph_clone",
"rocksdb.data_path": "./rks-data-xx",
"rocksdb.wal_path": "./rks-data-xx"
}
Response Status200Response Body{
"name": "hugegraph_clone",
"backend": "rocksdb"
}6.1.5 创建一个图,该操作需要管理员权限Params路径参数说明:
Method & UrlRequest Body创建一个非鉴权模式的图(设置 {
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
"backend": "rocksdb",
"serializer": "binary",
"store": "hugegraph",
"rocksdb.data_path": "./rks-data-xx",
"rocksdb.wal_path": "./rks-data-xx"
}
Response Status200Response Body{
"name": "hugegraph2",
"backend": "rocksdb"
}
6.1.6 删除某个图及其全部数据Params路径参数说明:
请求参数说明: 由于删除图是一个比较危险的操作,为避免用户误调用,我们给 API 添加了用于确认的参数:
Method & UrlDELETE
http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graphResponse Status204
6.2 Conf6.2.1 查看某个图的配置,该操作需要管理员权限Method & UrlGET
http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/confResponse Status200Response Body# gremlin entrence to create graph
gremlin.graph=org.apache.hugegraph.HugeFactory
# cache config
#schema.cache_capacity=1048576
#graph.cache_capacity=10485760
#graph.cache_expire=600
# schema illegal name template
#schema.illegal_name_regex=\s+|~.*
#vertex.default_label=vertex
backend=cassandra
serializer=cassandra
store=hugegraph
...=6.3 Mode合法的图模式包括:NONE,RESTORING,MERGING,LOADING
Restore 时存在两种不同的模式:Restoring 和 Merging
正常情况下,图模式为 None,当需要 Restore 图时,需要根据需要临时修改图模式为 Restoring 模式或者 Merging 6.3.1 查看某个图的模式。Method & UrlResponse Status200Response Body{
"mode": "NONE"
}
6.3.2 设置某个图的模式。该操作需要管理员权限Method & UrlRequest Body
Response Status200Response Body{
"mode": "RESTORING"
}6.3.3 查看某个图的读模式。Params
Method & UrlResponse Status200Response Body{
"graph_read_mode": "ALL"
}6.3.4 设置某个图的读模式。该操作需要管理员权限Params
Method & UrlRequest Body
Response Status200Response Body{
"graph_read_mode": "OLTP_ONLY"
}6.4 Snapshot6.4.1 创建快照Params
Method & UrlResponse Status200Response Body{
"hugegraph": "snapshot_created"
}6.4.2 快照恢复Params
Method & UrlResponse Status200Response Body{
"hugegraph": "snapshot_resumed"
}6.5 Compact6.5.1 手动压缩图,该操作需要管理员权限Params
Method & UrlResponse Status200Response Body{
"nodes": 1,
"cluster_id": "local",
"servers": {
"local": "OK"
}
} |
…7.0 - use JSON body format Co-authored-by: imbajin <17706099+imbajin@users.noreply.github.com>
已根据您提供的完整 API 文档修正实现 (commit 709f7e9): 主要修正:
所有实现现在完全符合您提供的 1.7.0 API 文档,包括使用 JSON 配置格式和 graphspace 路径前缀。 |
HugeGraph 1.7.0 introduces graphspace-aware API paths that require updating the Python client to support dynamic graph management operations. Based on the official HugeGraph 1.7.0 REST API documentation, this PR implements the correct graphspace-prefixed endpoints with JSON configuration format.
Changes
Dynamic Graph Operations (
graphs.py)Extended
GraphsManagerwith runtime graph management using official graphspace-aware API endpoints:Context Switching (
client.py)Single client instance operates across multiple graphs and graphspaces:
Implementation
/graphspaces/{graphspace}/graphs/prefix for 1.7.0+GET /graphspaces/{graphspace}/graphsGET /graphspaces/{graphspace}/graphs/{graph}DELETE /graphspaces/{graphspace}/graphs/{graph}/clear?confirm_message=...POST /graphspaces/{graphspace}/graphs/{graph}with JSON bodyPOST /graphspaces/{graphspace}/graphs/{new}?clone_graph_name={source}with optional JSON bodyDELETE /graphspaces/{graphspace}/graphs/{graph}?confirm_message=...GET /graphspaces/{graphspace}/graphs/{graph}/conf_clear_cached_managers()to invalidate cache on context switchNote on Graphspaces
In HugeGraph 1.7.0+, graphspace is integrated into all graph API paths as
/graphspaces/{graphspace}/graphs/. The graphspace parameter is required when initializing the client for proper URL routing. The implementation automatically detects the server version and uses appropriate paths and configuration formats.Testing
Files Modified: 3 files updated
Fixes #59
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.