HDFS-13249. Document webhdfs support for getting snapshottable directory list. Contributed by Lokesh Jain.

This commit is contained in:
Xiaoyu Yao 2018-03-14 09:07:38 -07:00
parent ad1b988a82
commit a34d83d2fd
1 changed files with 92 additions and 0 deletions

View File

@ -51,6 +51,7 @@ The HTTP REST API supports the complete [FileSystem](../../api/org/apache/hadoop
* [`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)
* [`GETSNAPSHOTTABLEDIRECTORYLIST`](#Get_Snapshottable_Directory_List)
* 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)
@ -1282,6 +1283,45 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).renameSna
{"SnapshotDiffReport":{"diffList":[],"fromSnapshot":"s3","snapshotRoot":"/foo","toSnapshot":"s4"}}
### Get Snapshottable Directory List
* Submit a HTTP GET request.
curl -i GET "http://<HOST>:<PORT>/webhdfs/v1/?user.name=<USER>&op=GETSNAPSHOTTABLEDIRECTORYLIST"
If the USER is not the hdfs super user, the call lists only the snapshottable directories owned by the user. If the USER is the hdfs super user, the call lists all the snapshottable directories. The client receives a response with a [`SnapshottableDirectoryList` JSON object](#SnapshottableDirectoryList_JSON_Schema):
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
{
"SnapshottableDirectoryList":
[
{
"dirStatus":
{
"accessTime":0,
"blockSize":0,
"childrenNum":0,
"fileId":16386,
"group":"hadoop",
"length":0,
"modificationTime":1520761889225,
"owner":"random",
"pathSuffix":"bar",
"permission":"755",
"replication":0,
"storagePolicy":0,
"type":"DIRECTORY"
},
"parentFullPath":"/",
"snapshotNumber":0,
"snapshotQuota":65536
}
]
}
Delegation Token Operations
---------------------------
@ -2135,6 +2175,58 @@ var diffReportEntries =
}
```
### SnapshottableDirectoryList JSON Schema
```json
{
"name": "SnapshottableDirectoryList",
"type": "object",
"properties":
{
"SnapshottableDirectoryList":
{
"description": "An array of SnapshottableDirectoryStatus",
"type" : "array",
"items" : snapshottableDirectoryStatus,
"required" : true
}
}
}
```
#### SnapshottableDirectoryStatus
JavaScript syntax is used to define `snapshottableDirectoryStatus` so that it can be referred in `SnapshottableDirectoryList` JSON schema.
```javascript
var snapshottableDirectoryStatus =
{
"type": "object",
"properties":
{
"dirStatus": fileStatusProperties,
"parentFullPath":
{
"description" : "Full path of the parent of snapshottable directory",
"type" : "string",
"required" : true
},
"snapshotNumber":
{
"description" : "Number of snapshots created on the snapshottable directory",
"type" : "integer",
"required" : true
},
"snapshotQuota":
{
"description" : "Total number of snapshots allowed on the snapshottable directory",
"type" : "integer",
"required" : true
}
}
}
```
HTTP Query Parameter Dictionary
-------------------------------