gpt4 book ai didi

org.apache.hadoop.fs.XAttr.getName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 03:04:40 33 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.fs.XAttr.getName()方法的一些代码示例,展示了XAttr.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAttr.getName()方法的具体详情如下:
包路径:org.apache.hadoop.fs.XAttr
类名称:XAttr
方法名:getName

XAttr.getName介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

for (XAttr aXAttr : xAttrs) {
 if (aXAttr.getNameSpace() == search.getNameSpace()
   && aXAttr.getName().equals(search.getName())) {

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

XAttrSetFlag.validate(xAttr.getName(), exist, flag);

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

static int toInt(XAttr a) {
 int nid = SerialNumberManager.XATTR.getSerialNumber(a.getName());
 int nsOrd = a.getNameSpace().ordinal();
 long value = NS.BITS.combine(nsOrd & NS_MASK, 0L);
 value = NS_EXT.BITS.combine(nsOrd >>> NS_EXT_SHIFT, value);
 value = NAME.BITS.combine(nid, value);
 return (int)value;
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

/**
 * Verifies that the combined size of the name and value of an xattr is within
 * the configured limit. Setting a limit of zero disables this check.
 */
private static void checkXAttrSize(FSDirectory fsd, XAttr xAttr) {
 int size = DFSUtil.string2Bytes(xAttr.getName()).length;
 if (xAttr.getValue() != null) {
  size += xAttr.getValue().length;
 }
 if (size > fsd.getXattrMaxSize()) {
  throw new HadoopIllegalArgumentException(
    "The XAttr is too big. The maximum combined size of the"
    + " name and value is " + fsd.getXattrMaxSize()
    + ", but the total size is " + size);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

private static void appendXAttrsToXml(ContentHandler contentHandler,
  List<XAttr> xAttrs) throws SAXException {
 for (XAttr xAttr: xAttrs) {
  contentHandler.startElement("", "", "XATTR", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "NAMESPACE",
    xAttr.getNameSpace().toString());
  XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
  if (xAttr.getValue() != null) {
   try {
    XMLUtils.addSaxString(contentHandler, "VALUE",
      XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
  contentHandler.endElement("", "", "XATTR");
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

private void addEncryptionZone(INodeWithAdditionalFields inode,
  XAttrFeature xaf) {
 if (xaf == null) {
  return;
 }
 XAttr xattr = xaf.getXAttr(CRYPTO_XATTR_ENCRYPTION_ZONE);
 if (xattr == null) {
  return;
 }
 try {
  final HdfsProtos.ZoneEncryptionInfoProto ezProto =
    HdfsProtos.ZoneEncryptionInfoProto.parseFrom(xattr.getValue());
  ezManager.unprotectedAddEncryptionZone(inode.getId(),
    PBHelperClient.convert(ezProto.getSuite()),
    PBHelperClient.convert(ezProto.getCryptoProtocolVersion()),
    ezProto.getKeyName());
  if (ezProto.hasReencryptionProto()) {
   final ReencryptionInfoProto reProto = ezProto.getReencryptionProto();
   // inodes parents may not be loaded if this is done during fsimage
   // loading so cannot set full path now. Pass in null to indicate that.
   ezManager.getReencryptionStatus()
     .updateZoneStatus(inode.getId(), null, reProto);
  }
 } catch (InvalidProtocolBufferException e) {
  NameNode.LOG.warn("Error parsing protocol buffer of " +
    "EZ XAttr " + xattr.getName() + " dir:" + inode.getFullPathName());
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

boolean foundIt = false;
for (XAttr a : filteredAll) {
 if (xAttr.getNameSpace() == a.getNameSpace() && xAttr.getName().equals(
   a.getName())) {
  toGet.add(a);
  foundIt = true;

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Verifies that the combined size of the name and value of an xattr is within
 * the configured limit. Setting a limit of zero disables this check.
 */
private static void checkXAttrSize(FSDirectory fsd, XAttr xAttr) {
 if (fsd.getXattrMaxSize() == 0) {
  return;
 }
 int size = DFSUtil.string2Bytes(xAttr.getName()).length;
 if (xAttr.getValue() != null) {
  size += xAttr.getValue().length;
 }
 if (size > fsd.getXattrMaxSize()) {
  throw new HadoopIllegalArgumentException(
    "The XAttr is too big. The maximum combined size of the"
    + " name and value is " + fsd.getXattrMaxSize()
    + ", but the total size is " + size);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

i += 2;
if (xAttr.getNameSpace() == namespace &&
  xAttr.getName().equals(name)) {
 if (vlen > 0) {
  byte[] value = new byte[vlen];

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

public static boolean isStoragePolicyXAttr(XAttr xattr) {
  return xattr != null && xattr.getNameSpace() == XAttrNS
    && xattr.getName().equals(STORAGE_POLICY_XATTR_NAME);
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

public static boolean isStoragePolicyXAttr(XAttr xattr) {
  return xattr != null && xattr.getNameSpace() == XAttrNS
    && xattr.getName().equals(STORAGE_POLICY_XATTR_NAME);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs-client

/**
 * Get name with prefix from <code>XAttr</code>
 */
public static String getPrefixedName(XAttr xAttr) {
 if (xAttr == null) {
  return null;
 }
 return getPrefixedName(xAttr.getNameSpace(), xAttr.getName());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

/**
 * Get name with prefix from <code>XAttr</code>
 */
public static String getPrefixName(XAttr xAttr) {
 if (xAttr == null) {
  return null;
 }
 
 String namespace = xAttr.getNameSpace().toString();
 return StringUtils.toLowerCase(namespace) + "." + xAttr.getName();
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Get name with prefix from <code>XAttr</code>
 */
public static String getPrefixName(XAttr xAttr) {
 if (xAttr == null) {
  return null;
 }
 
 String namespace = xAttr.getNameSpace().toString();
 return StringUtils.toLowerCase(namespace) + "." + xAttr.getName();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

public static List<XAttrProto> convertXAttrProto(
  List<XAttr> xAttrSpec) {
 if (xAttrSpec == null) {
  return Lists.newArrayListWithCapacity(0);
 }
 ArrayList<XAttrProto> xAttrs = Lists.newArrayListWithCapacity(
   xAttrSpec.size());
 for (XAttr a : xAttrSpec) {
  XAttrProto.Builder builder = XAttrProto.newBuilder();
  builder.setNamespace(convert(a.getNameSpace()));
  if (a.getName() != null) {
   builder.setName(a.getName());
  }
  if (a.getValue() != null) {
   builder.setValue(getByteString(a.getValue()));
  }
  xAttrs.add(builder.build());
 }
 return xAttrs;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

public static XAttrProto convertXAttrProto(XAttr a) {
 XAttrProto.Builder builder = XAttrProto.newBuilder();
 builder.setNamespace(convert(a.getNameSpace()));
 if (a.getName() != null) {
  builder.setName(a.getName());
 }
 if (a.getValue() != null) {
  builder.setValue(getByteString(a.getValue()));
 }
 return builder.build();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

private static void appendXAttrsToXml(ContentHandler contentHandler,
  List<XAttr> xAttrs) throws SAXException {
 for (XAttr xAttr: xAttrs) {
  contentHandler.startElement("", "", "XATTR", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "NAMESPACE",
    xAttr.getNameSpace().toString());
  XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
  if (xAttr.getValue() != null) {
   try {
    XMLUtils.addSaxString(contentHandler, "VALUE",
      XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
  contentHandler.endElement("", "", "XATTR");
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs-client

public static XAttrProto convertXAttrProto(XAttr a) {
 XAttrProto.Builder builder = XAttrProto.newBuilder();
 builder.setNamespace(convert(a.getNameSpace()));
 if (a.getName() != null) {
  builder.setName(a.getName());
 }
 if (a.getValue() != null) {
  builder.setValue(getByteString(a.getValue()));
 }
 return builder.build();
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

private static void appendXAttrsToXml(ContentHandler contentHandler,
  List<XAttr> xAttrs) throws SAXException {
 for (XAttr xAttr: xAttrs) {
  contentHandler.startElement("", "", "XATTR", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "NAMESPACE",
    xAttr.getNameSpace().toString());
  XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
  if (xAttr.getValue() != null) {
   try {
    XMLUtils.addSaxString(contentHandler, "VALUE",
      XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
   } catch (IOException e) {
    throw new SAXException(e);
   }
  }
  contentHandler.endElement("", "", "XATTR");
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

public static XAttrProto convertXAttrProto(XAttr a) {
 XAttrProto.Builder builder = XAttrProto.newBuilder();
 builder.setNamespace(convert(a.getNameSpace()));
 if (a.getName() != null) {
  builder.setName(a.getName());
 }
 if (a.getValue() != null) {
  builder.setValue(getByteString(a.getValue()));
 }
 return builder.build();
}

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com