Skip to content
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

update:append new api for graphs & translate #136

Merged
merged 3 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 239 additions & 1 deletion content/cn/docs/clients/restful-api/graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,98 @@ DELETE http://localhost:8080/graphs/hugegraph/clear?confirm_message=I%27m+sure+t
204
```

#### 6.1.4 克隆一个图,**该操作需要管理员权限**

##### Params

- clone_graph_name: 已有图的名称;从已有的图来克隆,用户可选择传递配置文件,传递时将替换已有图中的配置;

##### Method & Url

```
POST http://localhost:8080/graphs/hugegraph_clone?clone_graph_name=hugegraph
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add example for request body.

```

##### Request Body 【可选】

```
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
backend=rocksdb
serializer=binary
store=hugegraph_clone
rocksdb.data_path=./hg2
rocksdb.wal_path=./hg2
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"name": "hugegraph_clone",
"backend": "rocksdb"
}
```

#### 6.1.5 创建一个图,**该操作需要管理员权限**

##### Method & Url

```
POST http://localhost:8080/graphs/hugegraph2
```

##### Request Body

```
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
backend=rocksdb
serializer=binary
store=hugegraph2
rocksdb.data_path=./hg2
rocksdb.wal_path=./hg2
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"name": "hugegraph2",
"backend": "rocksdb"
}
```

#### 6.1.6 删除某个图及其全部数据

##### Params

由于删除图是一个比较危险的操作,为避免用户误调用,我们给API添加了用于确认的参数:

- confirm_message: 默认为`I'm sure to drop the graph`

##### Method & Url

```
DELETE http://localhost:8080/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
```

##### Response Status

```json
204
```

### 6.2 Conf

#### 6.2.1 查看某个图的配置,**该操作需要管理员权限**
Expand Down Expand Up @@ -135,7 +227,7 @@ Restore 时存在两种不同的模式: Restoring 和 Merging
正常情况下,图模式为 None,当需要 Restore 图时,需要根据需要临时修改图模式为 Restoring 模式或者 Merging 模式,并在完成 Restore 时,恢复图模式为 None。


#### 6.3.1 查看某个图的模式. **该操作需要管理员权限**
#### 6.3.1 查看某个图的模式.

##### Method & Url

Expand Down Expand Up @@ -188,3 +280,149 @@ PUT http://localhost:8080/graphs/hugegraph/mode
"mode": "RESTORING"
}
```

#### 6.3.3 查看某个图的读模式.

##### Params

- name: 图的名称

##### Method & Url

```
GET http://localhost:8080/graphs/hugegraph/graph_read_mode
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"graph_read_mode": "ALL"
}
```

#### 6.3.4 设置某个图的读模式. **该操作需要管理员权限**

##### Params

- name: 图的名称

##### Method & Url

```
PUT http://localhost:8080/graphs/hugegraph/graph_read_mode
```

##### Request Body

```
"OLTP_ONLY"
```

> 合法的图模式包括:ALL,OLTP_ONLY,OLAP_ONLY

##### Response Status

```json
200
```

##### Response Body

```json
{
"graph_read_mode": "OLTP_ONLY"
}
```

### 6.4 Snapshot

#### 6.4.1 创建快照

##### Params

- name: 图的名称

##### Method & Url

```
PUT http://localhost:8080/graphs/hugegraph/snapshot_create
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"hugegraph": "snapshot_created"
}
```

#### 6.4.2 快照恢复

##### Params

- name: 图的名称

##### Method & Url

```
PUT http://localhost:8080/graphs/hugegraph/snapshot_resume
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"hugegraph": "snapshot_resumed"
}
```

### 6.5 Compact

#### 6.5.1 手动压缩图,**该操作需要管理员权限**

##### Params

- name: 图的名称

##### Method & Url

```
PUT http://localhost:8080/graphs/hugegraph/compact
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"nodes": 1,
"cluster_id": "local",
"servers": {
"local": "OK"
}
}
```
Loading