hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1640247 [2/2] - in /hive/branches/HIVE-8065: common/src/java/org/apache/hadoop/hive/common/ common/src/java/org/apache/hadoop/hive/conf/ hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/ itests/util/src/main/java/org/apache/h...
Date Mon, 17 Nov 2014 22:36:48 GMT
Modified: hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
URL: http://svn.apache.org/viewvc/hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java?rev=1640247&r1=1640246&r2=1640247&view=diff
==============================================================================
--- hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
(original)
+++ hive/branches/HIVE-8065/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
Mon Nov 17 22:36:47 2014
@@ -774,4 +774,83 @@ public interface HadoopShims {
     public String getShortName() throws IOException;
   }
 
+  /**
+   * Copies a source dir/file to a destination by orchestrating the copy between hdfs nodes.
+   * This distributed process is meant to copy huge files that could take some time if a
single
+   * copy is done.
+   *
+   * @param src Path to the source file or directory to copy
+   * @param dst Path to the destination file or directory
+   * @param conf The hadoop configuration object
+   * @return True if it is successfull; False otherwise.
+   */
+  public boolean runDistCp(Path src, Path dst, Configuration conf) throws IOException;
+
+  /**
+   * This interface encapsulates methods used to get encryption information from
+   * HDFS paths.
+   */
+  public interface HdfsEncryptionShim {
+    /**
+     * Checks if a given HDFS path is encrypted.
+     *
+     * @param path Path to HDFS file system
+     * @return True if it is encrypted; False otherwise.
+     * @throws IOException If an error occurred attempting to get encryption information
+     */
+    public boolean isPathEncrypted(Path path) throws IOException;
+
+    /**
+     * Checks if two HDFS paths are on the same encrypted or unencrypted zone.
+     *
+     * @param path1 Path to HDFS file system
+     * @param path2 Path to HDFS file system
+     * @return True if both paths are in the same zone; False otherwise.
+     * @throws IOException If an error occurred attempting to get encryption information
+     */
+    public boolean arePathsOnSameEncryptionZone(Path path1, Path path2) throws IOException;
+
+    /**
+     * Compares two encrypted path strengths.
+     *
+     * @param path1 HDFS path to compare.
+     * @param path2 HDFS path to compare.
+     * @return 1 if path1 is stronger; 0 if paths are equals; -1 if path1 is weaker.
+     * @throws IOException If an error occurred attempting to get encryption/key metadata
+     */
+    public int comparePathKeyStrength(Path path1, Path path2) throws IOException;
+  }
+
+  /**
+   * This is a dummy class used when the hadoop version does not support hdfs encryption.
+   */
+  public static class NoopHdfsEncryptionShim implements HdfsEncryptionShim {
+    @Override
+    public boolean isPathEncrypted(Path path) throws IOException {
+    /* not supported */
+      return false;
+    }
+
+    @Override
+    public boolean arePathsOnSameEncryptionZone(Path path1, Path path2) throws IOException
{
+    /* not supported */
+      return true;
+    }
+
+    @Override
+    public int comparePathKeyStrength(Path path1, Path path2) throws IOException {
+    /* not supported */
+      return 0;
+    }
+  }
+
+  /**
+   * Returns a new instance of the HdfsEncryption shim.
+   *
+   * @param fs A FileSystem object to HDFS
+   * @param conf A Configuration object
+   * @return A new instance of the HdfsEncryption shim.
+   * @throws IOException If an error occurred while creating the instance.
+   */
+  public HdfsEncryptionShim createHdfsEncryptionShim(FileSystem fs, Configuration conf) throws
IOException;
 }



Mime
View raw message