HDFS-13190. Document WebHDFS support for snapshot diff

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
Signed-off-by: Xiaoyu Yao <xyao@apache.org>
This commit is contained in:
Lokesh Jain 2018-03-09 15:04:14 -08:00 committed by Akira Ajisaka
parent 9a082fbe6e
commit 7b0dc31020
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -50,6 +50,7 @@ The HTTP REST API supports the complete [FileSystem](../../api/org/apache/hadoop
* [`CHECKACCESS`](#Check_access) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).access)
* [`GETALLSTORAGEPOLICY`](#Get_all_Storage_Policies) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getAllStoragePolicies)
* [`GETSTORAGEPOLICY`](#Get_Storage_Policy) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getStoragePolicy)
* [`GETSNAPSHOTDIFF`](#Get_Snapshot_Diff)
* HTTP PUT
* [`CREATE`](#Create_and_Write_to_a_File) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).create)
* [`MKDIRS`](#Make_a_Directory) (see [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).mkdirs)
@ -1266,6 +1267,21 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).deleteSna
See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).renameSnapshot
### Get Snapshot Diff
* Submit a HTTP GET request.
curl -i GET "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=GETSNAPSHOTDIFF
&oldsnapshotname=<SNAPSHOTNAME>&snapshotname=<SNAPSHOTNAME>"
The client receives a response with a [`SnapshotDiffReport` JSON object](#SnapshotDiffReport_JSON_Schema):
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
{"SnapshotDiffReport":{"diffList":[],"fromSnapshot":"s3","snapshotRoot":"/foo","toSnapshot":"s4"}}
Delegation Token Operations
---------------------------
@ -2043,6 +2059,82 @@ A `BlockStoragePolicies` JSON object represents an array of `BlockStoragePolicy`
}
```
### SnapshotDiffReport JSON Schema
```json
{
"name": "SnapshotDiffReport",
"type": "object",
"properties":
{
"SnapshotDiffReport":
{
"type" : "object",
"properties" :
{
"diffList":
{
"description": "An array of DiffReportEntry",
"type" : "array",
"items" : diffReportEntries,
"required" : true
},
"fromSnapshot":
{
"description": "Source snapshot",
"type" : "string",
"required" : true
},
"snapshotRoot":
{
"description" : "String representation of snapshot root path",
"type" : "string",
"required" : true
},
"toSnapshot":
{
"description" : "Destination snapshot",
"type" : "string",
"required" : true
}
}
}
}
}
```
#### DiffReport Entries
JavaScript syntax is used to define `diffReportEntries` so that it can be referred in `SnapshotDiffReport` JSON schema.
```javascript
var diffReportEntries =
{
"type": "object",
"properties":
{
"sourcePath":
{
"description" : "Source path name relative to snapshot root",
"type" : "string",
"required" : true
},
"targetPath":
{
"description" : "Target path relative to snapshot root used for renames",
"type" : "string",
"required" : true
},
"type":
{
"description" : "Type of diff report entry",
"enum" : ["CREATE", "MODIFY", "DELETE", "RENAME"],
"required" : true
}
}
}
```
HTTP Query Parameter Dictionary
-------------------------------