Java Code Examples for org.apache.hadoop.hdfs.protocol.proto.HdfsProtos#ZoneEncryptionInfoProto

The following examples show how to use org.apache.hadoop.hdfs.protocol.proto.HdfsProtos#ZoneEncryptionInfoProto . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FSDirectory.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * This method is always called with writeLock of FSDirectory held.
 */
public final void addToInodeMap(INode inode) {
  if (inode instanceof INodeWithAdditionalFields) {
    inodeMap.put(inode);
    if (!inode.isSymlink()) {
      final XAttrFeature xaf = inode.getXAttrFeature();
      if (xaf != null) {
        final List<XAttr> xattrs = xaf.getXAttrs();
        for (XAttr xattr : xattrs) {
          final String xaName = XAttrHelper.getPrefixName(xattr);
          if (CRYPTO_XATTR_ENCRYPTION_ZONE.equals(xaName)) {
            try {
              final HdfsProtos.ZoneEncryptionInfoProto ezProto =
                  HdfsProtos.ZoneEncryptionInfoProto.parseFrom(
                      xattr.getValue());
              ezManager.unprotectedAddEncryptionZone(inode.getId(),
                  PBHelper.convert(ezProto.getSuite()),
                  PBHelper.convert(ezProto.getCryptoProtocolVersion()),
                  ezProto.getKeyName());
            } catch (InvalidProtocolBufferException e) {
              NameNode.LOG.warn("Error parsing protocol buffer of " +
                  "EZ XAttr " + xattr.getName());
            }
          }
        }
      }
    }
  }
}
 
Example 2
Source File: PBHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static HdfsProtos.ZoneEncryptionInfoProto convert(
    CipherSuite suite, CryptoProtocolVersion version, String keyName) {
  if (suite == null || version == null || keyName == null) {
    return null;
  }
  return HdfsProtos.ZoneEncryptionInfoProto.newBuilder()
      .setSuite(convert(suite))
      .setCryptoProtocolVersion(convert(version))
      .setKeyName(keyName)
      .build();
}
 
Example 3
Source File: FSDirectory.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * This method is always called with writeLock of FSDirectory held.
 */
public final void addToInodeMap(INode inode) {
  if (inode instanceof INodeWithAdditionalFields) {
    inodeMap.put(inode);
    if (!inode.isSymlink()) {
      final XAttrFeature xaf = inode.getXAttrFeature();
      if (xaf != null) {
        final List<XAttr> xattrs = xaf.getXAttrs();
        for (XAttr xattr : xattrs) {
          final String xaName = XAttrHelper.getPrefixName(xattr);
          if (CRYPTO_XATTR_ENCRYPTION_ZONE.equals(xaName)) {
            try {
              final HdfsProtos.ZoneEncryptionInfoProto ezProto =
                  HdfsProtos.ZoneEncryptionInfoProto.parseFrom(
                      xattr.getValue());
              ezManager.unprotectedAddEncryptionZone(inode.getId(),
                  PBHelper.convert(ezProto.getSuite()),
                  PBHelper.convert(ezProto.getCryptoProtocolVersion()),
                  ezProto.getKeyName());
            } catch (InvalidProtocolBufferException e) {
              NameNode.LOG.warn("Error parsing protocol buffer of " +
                  "EZ XAttr " + xattr.getName());
            }
          }
        }
      }
    }
  }
}
 
Example 4
Source File: PBHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static HdfsProtos.ZoneEncryptionInfoProto convert(
    CipherSuite suite, CryptoProtocolVersion version, String keyName) {
  if (suite == null || version == null || keyName == null) {
    return null;
  }
  return HdfsProtos.ZoneEncryptionInfoProto.newBuilder()
      .setSuite(convert(suite))
      .setCryptoProtocolVersion(convert(version))
      .setKeyName(keyName)
      .build();
}