Search in sources :

Example 16 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method getContentSummary.

@Override
public ContentSummary getContentSummary(final Path p) throws IOException {
    statistics.incrementReadOps(1);
    storageStatistics.incrementOpCounter(OpType.GET_CONTENT_SUMMARY);
    final HttpOpParam.Op op = GetOpParam.Op.GETCONTENTSUMMARY;
    return new FsPathResponseRunner<ContentSummary>(op, p) {

        @Override
        ContentSummary decodeResponse(Map<?, ?> json) {
            return JsonUtilClient.toContentSummary(json);
        }
    }.run();
}
Also used : ContentSummary(org.apache.hadoop.fs.ContentSummary) Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 17 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method createSnapshot.

@Override
public Path createSnapshot(final Path path, final String snapshotName) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.CREATE_SNAPSHOT);
    final HttpOpParam.Op op = PutOpParam.Op.CREATESNAPSHOT;
    return new FsPathResponseRunner<Path>(op, path, new SnapshotNameParam(snapshotName)) {

        @Override
        Path decodeResponse(Map<?, ?> json) {
            return new Path((String) json.get(Path.class.getSimpleName()));
        }
    }.run();
}
Also used : Path(org.apache.hadoop.fs.Path) Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 18 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method removeAcl.

@Override
public void removeAcl(Path path) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.REMOVE_ACL);
    final HttpOpParam.Op op = PutOpParam.Op.REMOVEACL;
    new FsPathRunner(op, path).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)

Example 19 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method create.

@Override
public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.CREATE);
    final FsPermission modes = applyUMask(permission);
    final HttpOpParam.Op op = PutOpParam.Op.CREATE;
    return new FsPathOutputStreamRunner(op, f, bufferSize, new PermissionParam(modes.getMasked()), new UnmaskedPermissionParam(modes.getUnmasked()), new OverwriteParam(overwrite), new BufferSizeParam(bufferSize), new ReplicationParam(replication), new BlockSizeParam(blockSize)).run();
}
Also used : Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) FsPermission(org.apache.hadoop.fs.permission.FsPermission)

Example 20 with Op

use of org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op in project hadoop by apache.

the class WebHdfsFileSystem method getTrashRoot.

@Override
public Path getTrashRoot(Path path) {
    statistics.incrementReadOps(1);
    storageStatistics.incrementOpCounter(OpType.GET_TRASH_ROOT);
    final HttpOpParam.Op op = GetOpParam.Op.GETTRASHROOT;
    try {
        String strTrashPath = new FsPathResponseRunner<String>(op, path) {

            @Override
            String decodeResponse(Map<?, ?> json) throws IOException {
                return JsonUtilClient.getPath(json);
            }
        }.run();
        return new Path(strTrashPath).makeQualified(getUri(), null);
    } catch (IOException e) {
        LOG.warn("Cannot find trash root of " + path, e);
        // keep the same behavior with dfs
        return super.getTrashRoot(path).makeQualified(getUri(), null);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) Op(org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op) IOException(java.io.IOException)

Aggregations

Op (org.apache.hadoop.hdfs.web.resources.HttpOpParam.Op)40 IOException (java.io.IOException)8 Path (org.apache.hadoop.fs.Path)3 FsPermission (org.apache.hadoop.fs.permission.FsPermission)3 FileNotFoundException (java.io.FileNotFoundException)2 Map (java.util.Map)1 ContentSummary (org.apache.hadoop.fs.ContentSummary)1 MD5MD5CRC32FileChecksum (org.apache.hadoop.fs.MD5MD5CRC32FileChecksum)1 AclStatus (org.apache.hadoop.fs.permission.AclStatus)1 HdfsFileStatus (org.apache.hadoop.hdfs.protocol.HdfsFileStatus)1 DelegationTokenIdentifier (org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier)1 AccessControlException (org.apache.hadoop.security.AccessControlException)1 InvalidToken (org.apache.hadoop.security.token.SecretManager.InvalidToken)1 Token (org.apache.hadoop.security.token.Token)1