Repository: hadoop Updated Branches: refs/heads/branch-3.1 ec951a3dd -> d12418b12
HDFS-13249. Document webhdfs support for getting snapshottable directory list. Contributed by Lokesh Jain. (cherry picked from commit 8cd22552eb7969cf9cf93f17d780b59405372d4b) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d12418b1 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d12418b1 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d12418b1 Branch: refs/heads/branch-3.1 Commit: d12418b12cbe6664c62c7f85bd10160c05bb89b9 Parents: ec951a3 Author: Xiaoyu Yao <[email protected]> Authored: Wed Mar 14 09:07:38 2018 -0700 Committer: Xiaoyu Yao <[email protected]> Committed: Wed Mar 14 09:09:38 2018 -0700 ---------------------------------------------------------------------- .../hadoop-hdfs/src/site/markdown/WebHDFS.md | 92 ++++++++++++++++++++ 1 file changed, 92 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/d12418b1/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md index 057ca59..eb11815 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md +++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/markdown/WebHDFS.md @@ -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 ------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
