Github user interma commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/1093#discussion_r96561207
--- Diff: depends/libhdfs3/src/client/Hdfs.cpp ---
@@ -1450,6 +1491,72 @@ void hdfsFreeFileBlockLocations(BlockLocation *
locations, int numOfBlock) {
delete [] locations;
}
+int hdfsCreateEncryptionZone(hdfsFS fs, const char * path, const char *
keyName) {
+ PARAMETER_ASSERT(fs && path && strlen(path) > 0 && keyName &&
strlen(keyName) > 0, -1, EINVAL);
+
+ try {
+ return fs->getFilesystem().createEncryptionZone(path, keyName) ? 0
: -1;
+ } catch (const std::bad_alloc & e) {
+ SetErrorMessage("Out of memory");
+ errno = ENOMEM;
+ } catch (...) {
+ SetLastException(Hdfs::current_exception());
+ handleException(Hdfs::current_exception());
+ }
+
+ return -1;
+}
+
+hdfsEncryptionZoneInfo * hdfsGetEZForPath(hdfsFS fs, const char * path) {
+ PARAMETER_ASSERT(fs && path && strlen(path) > 0, NULL, EINVAL);
+ hdfsEncryptionZoneInfo * retval = NULL;
+
+ try {
+ retval = new hdfsEncryptionZoneInfo[1];
+ memset(retval, 0, sizeof(hdfsEncryptionZoneInfo));
+ std::vector<Hdfs::EncryptionZoneInfo> enStatus(1);
+ enStatus[0] = fs->getFilesystem().getEZForPath(path);
+ ConstructHdfsEncryptionZoneInfo(retval, enStatus);
+ return retval;
+ } catch (const std::bad_alloc & e) {
+ SetErrorMessage("Out of memory");
+ hdfsFreeEncryptionZoneInfo(retval, 1);
+ errno = ENOMEM;
+ } catch (...) {
+ SetLastException(Hdfs::current_exception());
+ hdfsFreeEncryptionZoneInfo(retval, 1);
+ handleException(Hdfs::current_exception());
+ }
+
+ return NULL;
+}
+
+
+hdfsEncryptionZoneInfo * hdfsListEncryptionZones(hdfsFS fs, int *
numEntries) {
+ PARAMETER_ASSERT(fs, NULL, EINVAL);
+ hdfsEncryptionZoneInfo * retval = NULL;
+ int size = 0;
+
+ try {
+ std::vector<Hdfs::EncryptionZoneInfo> enStatus =
+ fs->getFilesystem().listAllEncryptionZoneItems();
+ size = enStatus.size();
+ retval = new hdfsEncryptionZoneInfo[size];
+ memset(retval, 0, sizeof(hdfsEncryptionZoneInfo) * size);
+ ConstructHdfsEncryptionZoneInfo(&retval[0], enStatus);
+ LOG(Hdfs::Internal::WARNING, "The size of hdfsEncryptionZoneInfo
is %d", size);
--- End diff --
log level: Warning => DEBUG is better?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---