/** * Write the string table to the fsimage. * @throws IOException */ private void writeStringTableSection() throws IOException { FsImageProto.StringTableSection sectionHeader = FsImageProto.StringTableSection.newBuilder(). setNumEntry(stringTable.size()).build(); if (LOG.isDebugEnabled()) { LOG.debug(SectionName.STRING_TABLE.name() + " writing header: {" + TextFormat.printToString(sectionHeader) + "}"); } sectionHeader.writeDelimitedTo(out); // The entries don't have to be in any particular order, so iterating // over the hash table is fine. for (Map.Entry<String, Integer> entry : stringTable.entrySet()) { FsImageProto.StringTableSection.Entry stEntry = FsImageProto.StringTableSection.Entry.newBuilder(). setStr(entry.getKey()). setId(entry.getValue()). build(); if (LOG.isTraceEnabled()) { LOG.trace("Writing string table entry: {" + TextFormat.printToString(stEntry) + "}"); } stEntry.writeDelimitedTo(out); } recordSectionLength(SectionName.STRING_TABLE.name()); }
static SerialNumberManager.StringTable loadStringTable(InputStream in) throws IOException { FsImageProto.StringTableSection s = FsImageProto.StringTableSection .parseDelimitedFrom(in); LOG.info("Loading " + s.getNumEntry() + " strings"); SerialNumberManager.StringTable stringTable = SerialNumberManager.newStringTable(s.getNumEntry(), s.getMaskBits()); for (int i = 0; i < s.getNumEntry(); ++i) { FsImageProto.StringTableSection.Entry e = FsImageProto .StringTableSection.Entry.parseDelimitedFrom(in); stringTable.put(e.getId(), e.getStr()); } return stringTable; }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeUInt32(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getStrBytes()); } getUnknownFields().writeTo(output); }
public Builder toBuilder() { return newBuilder(this); }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry buildPartial() { org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry result = new org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.str_ = str_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getStrBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry prototype) {
void writeStringTableSection() throws IOException { StringTableSection.Builder b = StringTableSection.newBuilder(); Map<Integer, String> u = ugis.ugiMap(); b.setNumEntry(u.size()); StringTableSection s = b.build(); OutputStream sec = beginSection(raw); s.writeDelimitedTo(sec); for (Map.Entry<Integer, String> e : u.entrySet()) { StringTableSection.Entry.Builder x = StringTableSection.Entry.newBuilder() .setId(e.getKey()) .setStr(e.getValue()); x.build().writeDelimitedTo(sec); } endSection(sec, SectionName.STRING_TABLE); }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry buildPartial() { org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry result = new org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.str_ = str_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry getDefaultInstanceForType() { return org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry.getDefaultInstance(); }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += io.prestosql.hadoop.$internal.com.google.protobuf.CodedOutputStream .computeUInt32Size(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += io.prestosql.hadoop.$internal.com.google.protobuf.CodedOutputStream .computeBytesSize(2, getStrBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry prototype) {
public Builder toBuilder() { return newBuilder(this); }
private void saveStringTableSection(FileSummary.Builder summary) throws IOException { OutputStream out = sectionOutputStream; StringTableSection.Builder b = StringTableSection.newBuilder() .setNumEntry(saverContext.stringMap.size()); b.build().writeDelimitedTo(out); for (Entry<String, Integer> e : saverContext.stringMap.entrySet()) { StringTableSection.Entry.Builder eb = StringTableSection.Entry .newBuilder().setId(e.getValue()).setStr(e.getKey()); eb.build().writeDelimitedTo(out); } commitSection(summary, SectionName.STRING_TABLE); } }
public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry getDefaultInstanceForType() { return org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry.getDefaultInstance(); }
static String[] loadStringTable(InputStream in) throws IOException { FsImageProto.StringTableSection s = FsImageProto.StringTableSection .parseDelimitedFrom(in); LOG.info("Loading " + s.getNumEntry() + " strings"); String[] stringTable = new String[s.getNumEntry() + 1]; for (int i = 0; i < s.getNumEntry(); ++i) { FsImageProto.StringTableSection.Entry e = FsImageProto .StringTableSection.Entry.parseDelimitedFrom(in); stringTable[e.getId()] = e.getStr(); } return stringTable; }
private void loadStringTable(InputStream in) throws IOException { StringTableSection s = StringTableSection.parseDelimitedFrom(in); stringTable = new String[s.getNumEntry() + 1]; for (int i = 0; i < s.getNumEntry(); ++i) { StringTableSection.Entry e = StringTableSection.Entry .parseDelimitedFrom(in); stringTable[e.getId()] = e.getStr(); } }
private void loadStringTableSection(InputStream in) throws IOException { StringTableSection s = StringTableSection.parseDelimitedFrom(in); ctx.stringTable = new String[s.getNumEntry() + 1]; for (int i = 0; i < s.getNumEntry(); ++i) { StringTableSection.Entry e = StringTableSection.Entry .parseDelimitedFrom(in); ctx.stringTable[e.getId()] = e.getStr(); } }
public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.Entry prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }