114 lines
2.0 KiB
Markdown
114 lines
2.0 KiB
Markdown
# FileChunkService
|
||
> 文件片段相关服务
|
||
|
||
---
|
||
|
||
## createFileChunk
|
||
> 创建文件片段
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/FileChunkService/createFileChunk`
|
||
- RPC:`rpc createFileChunk (CreateFileChunkRequest) returns (CreateFileChunkResponse);`
|
||
|
||
**请求对象 (`CreateFileChunkRequest`)**
|
||
|
||
```json
|
||
{
|
||
"fileId": "int64 // 文件ID",
|
||
"data": "bytes"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`CreateFileChunkResponse`)**
|
||
|
||
```json
|
||
{
|
||
"fileChunkId": "int64"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/FileChunkService/createFileChunk" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## downloadFileChunk
|
||
> 下载文件片段
|
||
|
||
- 角色:`dns`, `user`, `node`, `admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/FileChunkService/downloadFileChunk`
|
||
- RPC:`rpc downloadFileChunk (DownloadFileChunkRequest) returns (DownloadFileChunkResponse);`
|
||
|
||
**请求对象 (`DownloadFileChunkRequest`)**
|
||
|
||
```json
|
||
{
|
||
"fileChunkId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`DownloadFileChunkResponse`)**
|
||
|
||
```json
|
||
{
|
||
"fileChunk": "FileChunk"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/FileChunkService/downloadFileChunk" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findAllFileChunkIds
|
||
> 获取的一个文件的所有片段IDs
|
||
|
||
- 角色:`dns`, `user`, `node`, `admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/FileChunkService/findAllFileChunkIds`
|
||
- RPC:`rpc findAllFileChunkIds (FindAllFileChunkIdsRequest) returns (FindAllFileChunkIdsResponse);`
|
||
|
||
**请求对象 (`FindAllFileChunkIdsRequest`)**
|
||
|
||
```json
|
||
{
|
||
"fileId": "int64 // 文件ID"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindAllFileChunkIdsResponse`)**
|
||
|
||
```json
|
||
{
|
||
"fileChunkIds": "[]int64"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/FileChunkService/findAllFileChunkIds" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|