Java Code Examples for org.apache.hadoop.fs.XAttr#getName()
The following examples show how to use
org.apache.hadoop.fs.XAttr#getName() .
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: PBHelper.java From hadoop with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: PBHelper.java From big-c with Apache License 2.0 | 6 votes |
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; }
Example 3
Source File: XAttrHelper.java From hadoop with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 4
Source File: XAttrStorage.java From hadoop with Apache License 2.0 | 5 votes |
/** * Update xattrs of inode. * <p/> * Must be called while holding the FSDirectory write lock. * * @param inode INode to update * @param xAttrs to update xAttrs. * @param snapshotId id of the latest snapshot of the inode */ public static void updateINodeXAttrs(INode inode, List<XAttr> xAttrs, int snapshotId) throws QuotaExceededException { if (xAttrs == null || xAttrs.isEmpty()) { if (inode.getXAttrFeature() != null) { inode.removeXAttrFeature(snapshotId); } return; } // Dedupe the xAttr name and save them into a new interned list List<XAttr> internedXAttrs = Lists.newArrayListWithCapacity(xAttrs.size()); for (XAttr xAttr : xAttrs) { final String name = xAttr.getName(); String internedName = internedNames.get(name); if (internedName == null) { internedName = name; internedNames.put(internedName, internedName); } XAttr internedXAttr = new XAttr.Builder() .setName(internedName) .setNameSpace(xAttr.getNameSpace()) .setValue(xAttr.getValue()) .build(); internedXAttrs.add(internedXAttr); } // Save the list of interned xattrs ImmutableList<XAttr> newXAttrs = ImmutableList.copyOf(internedXAttrs); if (inode.getXAttrFeature() != null) { inode.removeXAttrFeature(snapshotId); } inode.addXAttrFeature(new XAttrFeature(newXAttrs), snapshotId); }
Example 5
Source File: PBHelper.java From hadoop with Apache License 2.0 | 5 votes |
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(); }
Example 6
Source File: XAttrHelper.java From big-c with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 7
Source File: XAttrStorage.java From big-c with Apache License 2.0 | 5 votes |
/** * Update xattrs of inode. * <p/> * Must be called while holding the FSDirectory write lock. * * @param inode INode to update * @param xAttrs to update xAttrs. * @param snapshotId id of the latest snapshot of the inode */ public static void updateINodeXAttrs(INode inode, List<XAttr> xAttrs, int snapshotId) throws QuotaExceededException { if (xAttrs == null || xAttrs.isEmpty()) { if (inode.getXAttrFeature() != null) { inode.removeXAttrFeature(snapshotId); } return; } // Dedupe the xAttr name and save them into a new interned list List<XAttr> internedXAttrs = Lists.newArrayListWithCapacity(xAttrs.size()); for (XAttr xAttr : xAttrs) { final String name = xAttr.getName(); String internedName = internedNames.get(name); if (internedName == null) { internedName = name; internedNames.put(internedName, internedName); } XAttr internedXAttr = new XAttr.Builder() .setName(internedName) .setNameSpace(xAttr.getNameSpace()) .setValue(xAttr.getValue()) .build(); internedXAttrs.add(internedXAttr); } // Save the list of interned xattrs ImmutableList<XAttr> newXAttrs = ImmutableList.copyOf(internedXAttrs); if (inode.getXAttrFeature() != null) { inode.removeXAttrFeature(snapshotId); } inode.addXAttrFeature(new XAttrFeature(newXAttrs), snapshotId); }
Example 8
Source File: PBHelper.java From big-c with Apache License 2.0 | 5 votes |
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(); }