private void save(OutputStream out, INodeSymlink n) throws IOException { SaverContext state = parent.getSaverContext(); INodeSection.INodeSymlink.Builder b = INodeSection.INodeSymlink .newBuilder() .setPermission(buildPermissionStatus(n)) .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); }
private void processSymlinkXml(Node node, INodeSection.INode.Builder inodeBld) throws IOException { inodeBld.setType(INodeSection.INode.Type.SYMLINK); INodeSection.INodeSymlink.Builder bld = INodeSection.INodeSymlink.newBuilder(); String perm = node.removeChildStr(INODE_SECTION_PERMISSION); if (perm != null) { bld.setPermission(permissionXmlToU64(perm)); } String target = node.removeChildStr(INODE_SECTION_TARGET); if (target != null) { bld.setTarget(ByteString.copyFrom(target, "UTF8")); } Long lval = node.removeChildLong(INODE_SECTION_MTIME); if (lval != null) { bld.setModificationTime(lval); } lval = node.removeChildLong(INODE_SECTION_ATIME); if (lval != null) { bld.setAccessTime(lval); } inodeBld.setSymlink(bld); // Will check remaining keys and serialize in processINodeXml }
INodeSection.INode r = INodeSection.INode.newBuilder() .setId(sroot.getId()) .setType(INodeSection.INode.Type.DIRECTORY) .setName(ByteString.copyFrom(sroot.getLocalNameBytes())) .setDirectory(db).build();
.setType(INode.Type.FILE) .setId(id) .setName(ByteString.copyFrom(string2Bytes(s.getPath().getName())))
INodeSection.INode r = INodeSection.INode.newBuilder() .setId(sroot.getId()) .setType(INodeSection.INode.Type.DIRECTORY) .setName(ByteString.copyFrom(sroot.getLocalNameBytes())) .setDirectory(db).build();
INodeSection.INode r = INodeSection.INode.newBuilder() .setId(sroot.getId()) .setType(INodeSection.INode.Type.DIRECTORY) .setName(ByteString.copyFrom(sroot.getLocalNameBytes())) .setDirectory(db).build();
public Builder mergeFrom(org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode other) { if (other == org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasId()) { setId(other.getId()); } if (other.hasName()) { setName(other.getName()); } if (other.hasFile()) { mergeFile(other.getFile()); } if (other.hasDirectory()) { mergeDirectory(other.getDirectory()); } if (other.hasSymlink()) { mergeSymlink(other.getSymlink()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode other) { if (other == org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasId()) { setId(other.getId()); } if (other.hasName()) { setName(other.getName()); } if (other.hasFile()) { mergeFile(other.getFile()); } if (other.hasDirectory()) { mergeDirectory(other.getDirectory()); } if (other.hasSymlink()) { mergeSymlink(other.getSymlink()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
private void save(OutputStream out, INodeFile n) throws IOException { INodeSection.INodeFile.Builder b = buildINodeFile(n, parent.getSaverContext()); if (n.getBlocks() != null) { for (Block block : n.getBlocks()) { b.addBlocks(PBHelper.convert(block)); } } FileUnderConstructionFeature uc = n.getFileUnderConstructionFeature(); if (uc != null) { INodeSection.FileUnderConstructionFeature f = INodeSection.FileUnderConstructionFeature .newBuilder().setClientName(uc.getClientName()) .setClientMachine(uc.getClientMachine()).build(); b.setFileUC(f); } INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.FILE).setFile(b).build(); r.writeDelimitedTo(out); }
private void save(OutputStream out, INodeFile n) throws IOException { INodeSection.INodeFile.Builder b = buildINodeFile(n, parent.getSaverContext()); if (n.getBlocks() != null) { for (Block block : n.getBlocks()) { b.addBlocks(PBHelper.convert(block)); } } FileUnderConstructionFeature uc = n.getFileUnderConstructionFeature(); if (uc != null) { INodeSection.FileUnderConstructionFeature f = INodeSection.FileUnderConstructionFeature .newBuilder().setClientName(uc.getClientName()) .setClientMachine(uc.getClientMachine()).build(); b.setFileUC(f); } INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.FILE).setFile(b).build(); r.writeDelimitedTo(out); }
INode toDirectory(UGIResolver ugi) { final FileStatus s = getFileStatus(); ugi.addUser(s.getOwner()); ugi.addGroup(s.getGroup()); INodeDirectory.Builder b = INodeDirectory.newBuilder() .setModificationTime(s.getModificationTime()) .setNsQuota(DEFAULT_NAMESPACE_QUOTA) .setDsQuota(DEFAULT_STORAGE_SPACE_QUOTA) .setPermission(ugi.resolve(s)); INode.Builder ib = INode.newBuilder() .setType(INode.Type.DIRECTORY) .setId(id) .setName(ByteString.copyFrom(string2Bytes(s.getPath().getName()))) .setDirectory(b); return ib.build(); }
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); }
private void save(OutputStream out, INodeDirectory n) throws IOException { INodeSection.INodeDirectory.Builder b = buildINodeDirectory(n, parent.getSaverContext()); INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.DIRECTORY).setDirectory(b).build(); r.writeDelimitedTo(out); }
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); }
private void save(OutputStream out, INodeDirectory n) throws IOException { INodeSection.INodeDirectory.Builder b = buildINodeDirectory(n, parent.getSaverContext()); INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.DIRECTORY).setDirectory(b).build(); r.writeDelimitedTo(out); }
public Builder mergeFrom(org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode other) { if (other == org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasId()) { setId(other.getId()); } if (other.hasName()) { setName(other.getName()); } if (other.hasFile()) { mergeFile(other.getFile()); } if (other.hasDirectory()) { mergeDirectory(other.getDirectory()); } if (other.hasSymlink()) { mergeSymlink(other.getSymlink()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
private void save(OutputStream out, INodeFile n) throws IOException { INodeSection.INodeFile.Builder b = buildINodeFile(n, parent.getSaverContext()); BlockInfo[] blocks = n.getBlocks(); if (blocks != null) { for (Block block : n.getBlocks()) { b.addBlocks(PBHelperClient.convert(block)); } } FileUnderConstructionFeature uc = n.getFileUnderConstructionFeature(); if (uc != null) { INodeSection.FileUnderConstructionFeature f = INodeSection.FileUnderConstructionFeature .newBuilder().setClientName(uc.getClientName()) .setClientMachine(uc.getClientMachine()).build(); b.setFileUC(f); } INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.FILE).setFile(b).build(); r.writeDelimitedTo(out); }
private void processDirectoryXml(Node node, INodeSection.INode.Builder inodeBld) throws IOException { inodeBld.setType(INodeSection.INode.Type.DIRECTORY); INodeSection.INodeDirectory.Builder bld = createINodeDirectoryBuilder(node); inodeBld.setDirectory(bld); // Will check remaining keys and serialize in processINodeXml }
private void save(OutputStream out, INodeDirectory n) throws IOException { INodeSection.INodeDirectory.Builder b = buildINodeDirectory(n, parent.getSaverContext()); INodeSection.INode r = buildINodeCommon(n) .setType(INodeSection.INode.Type.DIRECTORY).setDirectory(b).build(); r.writeDelimitedTo(out); }
private void processFileXml(Node node, INodeSection.INode.Builder inodeBld) throws IOException { inodeBld.setType(INodeSection.INode.Type.FILE); INodeSection.INodeFile.Builder bld = createINodeFileBuilder(node); inodeBld.setFile(bld); // Will check remaining keys and serialize in processINodeXml }