Java 类org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf.SaverContext 实例源码

项目:hadoop    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:hadoop    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication())
      .setStoragePolicyID(file.getLocalStoragePolicyID());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = file.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:hadoop    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  QuotaCounts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.getNameSpace())
      .setDsQuota(quota.getStorageSpace())
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  if (quota.getTypeSpaces().anyGreaterOrEqual(0)) {
    b.setTypeQuotas(buildQuotaByStorageTypeEntries(quota));
  }

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = dir.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelperClient.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication())
      .setStoragePolicyID(file.getLocalStoragePolicyID())
      .setIsStriped(file.isStriped());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = file.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  QuotaCounts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.getNameSpace())
      .setDsQuota(quota.getStorageSpace())
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  if (quota.getTypeSpaces().anyGreaterOrEqual(0)) {
    b.setTypeQuotas(buildQuotaByStorageTypeEntries(quota));
  }

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = dir.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:big-c    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:big-c    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication())
      .setStoragePolicyID(file.getLocalStoragePolicyID());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = file.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:big-c    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  QuotaCounts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.getNameSpace())
      .setDsQuota(quota.getStorageSpace())
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  if (quota.getTypeSpaces().anyGreaterOrEqual(0)) {
    b.setTypeQuotas(buildQuotaByStorageTypeEntries(quota));
  }

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = dir.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication())
      .setStoragePolicyID(file.getLocalStoragePolicyID());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = file.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  Quota.Counts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.get(Quota.NAMESPACE))
      .setDsQuota(quota.get(Quota.DISKSPACE))
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = dir.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
    final SaverContext.DeduplicationMap<String> stringMap) {
  XAttrFeatureProto.Builder b = XAttrFeatureProto.newBuilder();
  for (XAttr a : f.getXAttrs()) {
    XAttrCompactProto.Builder xAttrCompactBuilder = XAttrCompactProto.
        newBuilder();
    int nsOrd = a.getNameSpace().ordinal();
    Preconditions.checkArgument(nsOrd < 8, "Too many namespaces.");
    int v = ((nsOrd & XATTR_NAMESPACE_MASK) << XATTR_NAMESPACE_OFFSET)
        | ((stringMap.getId(a.getName()) & XATTR_NAME_MASK) <<
            XATTR_NAME_OFFSET);
    v |= (((nsOrd >> 2) & XATTR_NAMESPACE_EXT_MASK) <<
        XATTR_NAMESPACE_EXT_OFFSET);
    xAttrCompactBuilder.setName(v);
    if (a.getValue() != null) {
      xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
    }
    b.addXAttrs(xAttrCompactBuilder.build());
  }

  return b;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication())
      .setStoragePolicyID(file.getLocalStoragePolicyID());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = file.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  Quota.Counts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.get(Quota.NAMESPACE))
      .setDsQuota(quota.get(Quota.DISKSPACE))
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  XAttrFeature xAttrFeature = dir.getXAttrFeature();
  if (xAttrFeature != null) {
    b.setXAttrs(buildXAttrs(xAttrFeature, state.getStringMap()));
  }
  return b;
}
项目:hadoop    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:hadoop    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (int pos = 0, e; pos < f.getEntriesSize(); pos++) {
    e = f.getEntryAt(pos);
    int nameId = map.getId(AclEntryStatusFormat.getName(e));
    int v = ((nameId & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (AclEntryStatusFormat.getType(e).ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (AclEntryStatusFormat.getScope(e).ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (AclEntryStatusFormat.getPermission(e).ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:hadoop    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (int pos = 0, e; pos < f.getEntriesSize(); pos++) {
    e = f.getEntryAt(pos);
    int nameId = map.getId(AclEntryStatusFormat.getName(e));
    int v = ((nameId & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (AclEntryStatusFormat.getType(e).ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (AclEntryStatusFormat.getScope(e).ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (AclEntryStatusFormat.getPermission(e).ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}
项目:big-c    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:big-c    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (int pos = 0, e; pos < f.getEntriesSize(); pos++) {
    e = f.getEntryAt(pos);
    int nameId = map.getId(AclEntryStatusFormat.getName(e));
    int v = ((nameId & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (AclEntryStatusFormat.getType(e).ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (AclEntryStatusFormat.getScope(e).ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (AclEntryStatusFormat.getPermission(e).ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:big-c    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (AclEntry e : f.getEntries()) {
    int v = ((map.getId(e.getName()) & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (e.getType().ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (e.getScope().ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (e.getPermission().ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (AclEntry e : f.getEntries()) {
    int v = ((map.getId(e.getName()) & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (e.getType().ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (e.getScope().ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (e.getPermission().ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:FlexMap    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
private static long buildPermissionStatus(INodeAttributes n,
    final SaverContext.DeduplicationMap<String> stringMap) {
  long userId = stringMap.getId(n.getUserName());
  long groupId = stringMap.getId(n.getGroupName());
  return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
      | ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
      | n.getFsPermissionShort();
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
private static AclFeatureProto.Builder buildAclEntries(AclFeature f,
    final SaverContext.DeduplicationMap<String> map) {
  AclFeatureProto.Builder b = AclFeatureProto.newBuilder();
  for (AclEntry e : f.getEntries()) {
    int v = ((map.getId(e.getName()) & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET)
        | (e.getType().ordinal() << ACL_ENTRY_TYPE_OFFSET)
        | (e.getScope().ordinal() << ACL_ENTRY_SCOPE_OFFSET)
        | (e.getPermission().ordinal());
    b.addEntries(v);
  }
  return b;
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeFile.Builder buildINodeFile(
    INodeFileAttributes file, final SaverContext state) {
  INodeSection.INodeFile.Builder b = INodeSection.INodeFile.newBuilder()
      .setAccessTime(file.getAccessTime())
      .setModificationTime(file.getModificationTime())
      .setPermission(buildPermissionStatus(file, state.getStringMap()))
      .setPreferredBlockSize(file.getPreferredBlockSize())
      .setReplication(file.getFileReplication());

  AclFeature f = file.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  return b;
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
public static INodeSection.INodeDirectory.Builder buildINodeDirectory(
    INodeDirectoryAttributes dir, final SaverContext state) {
  Quota.Counts quota = dir.getQuotaCounts();
  INodeSection.INodeDirectory.Builder b = INodeSection.INodeDirectory
      .newBuilder().setModificationTime(dir.getModificationTime())
      .setNsQuota(quota.get(Quota.NAMESPACE))
      .setDsQuota(quota.get(Quota.DISKSPACE))
      .setPermission(buildPermissionStatus(dir, state.getStringMap()));

  AclFeature f = dir.getAclFeature();
  if (f != null) {
    b.setAcl(buildAclEntries(f, state.getStringMap()));
  }
  return b;
}
项目:hadoop-on-lustre2    文件:FSImageFormatPBINode.java   
private void save(OutputStream out, INodeSymlink n) throws IOException {
  SaverContext state = parent.getSaverContext();
  INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink
      .newBuilder()
      .setPermission(buildPermissionStatus(n, state.getStringMap()))
      .setTarget(ByteString.copyFrom(n.getSymlink()))
      .setModificationTime(n.getModificationTime())
      .setAccessTime(n.getAccessTime());

  INodeSection.INode r = buildINodeCommon(n)
      .setType(INodeSection.INode.Type.SYMLINK).setSymlink(b).build();
  r.writeDelimitedTo(out);
}