|
@@ -35,6 +35,7 @@ import org.apache.hadoop.fs.ContentSummary;
|
|
|
import org.apache.hadoop.fs.DelegationTokenRenewer;
|
|
|
import org.apache.hadoop.fs.FSDataInputStream;
|
|
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
|
|
+import org.apache.hadoop.fs.FsStatus;
|
|
|
import org.apache.hadoop.fs.FileChecksum;
|
|
|
import org.apache.hadoop.fs.FileStatus;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
@@ -188,6 +189,7 @@ public class HttpFSFileSystem extends FileSystem
|
|
|
|
|
|
public static final String FILE_STATUSES_JSON = "FileStatuses";
|
|
|
public static final String FILE_STATUS_JSON = "FileStatus";
|
|
|
+ public static final String FS_STATUS_JSON = "FsStatus";
|
|
|
public static final String PATH_SUFFIX_JSON = "pathSuffix";
|
|
|
public static final String TYPE_JSON = "type";
|
|
|
public static final String LENGTH_JSON = "length";
|
|
@@ -208,6 +210,9 @@ public class HttpFSFileSystem extends FileSystem
|
|
|
public static final String XATTRNAMES_JSON = "XAttrNames";
|
|
|
public static final String ECPOLICY_JSON = "ecPolicyObj";
|
|
|
public static final String SYMLINK_JSON = "symlink";
|
|
|
+ public static final String CAPACITY_JSON = "capacity";
|
|
|
+ public static final String USED_JSON = "used";
|
|
|
+ public static final String REMAINING_JSON = "remaining";
|
|
|
|
|
|
public static final String FILE_CHECKSUM_JSON = "FileChecksum";
|
|
|
public static final String CHECKSUM_ALGORITHM_JSON = "algorithm";
|
|
@@ -278,6 +283,7 @@ public class HttpFSFileSystem extends FileSystem
|
|
|
CHECKACCESS(HTTP_GET), SETECPOLICY(HTTP_PUT), GETECPOLICY(HTTP_GET), UNSETECPOLICY(
|
|
|
HTTP_POST), SATISFYSTORAGEPOLICY(HTTP_PUT), GETSNAPSHOTDIFFLISTING(HTTP_GET),
|
|
|
GETFILELINKSTATUS(HTTP_GET),
|
|
|
+ GETSTATUS(HTTP_GET),
|
|
|
GET_BLOCK_LOCATIONS(HTTP_GET);
|
|
|
|
|
|
private String httpMethod;
|
|
@@ -1756,6 +1762,17 @@ public class HttpFSFileSystem extends FileSystem
|
|
|
return status.makeQualified(getUri(), path);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public FsStatus getStatus(final Path path) throws IOException {
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put(OP_PARAM, Operation.GETSTATUS.toString());
|
|
|
+ HttpURLConnection conn =
|
|
|
+ getConnection(Operation.GETSTATUS.getMethod(), params, path, true);
|
|
|
+ HttpExceptionUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
|
|
|
+ JSONObject json = (JSONObject) HttpFSUtils.jsonParse(conn);
|
|
|
+ return JsonUtilClient.toFsStatus(json);
|
|
|
+ }
|
|
|
+
|
|
|
@VisibleForTesting
|
|
|
static BlockLocation[] toBlockLocations(JSONObject json) throws IOException {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|