/** * 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, numEntry_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeUInt32(2, maskBits_); } getUnknownFields().writeTo(output); }
io.prestosql.hadoop.$internal.com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws io.prestosql.hadoop.$internal.com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; io.prestosql.hadoop.$internal.com.google.protobuf.UnknownFieldSet.Builder unknownFields = break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
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 Builder toBuilder() { return newBuilder(this); }
public Builder toBuilder() { return newBuilder(this); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection prototype) {
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 org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection getDefaultInstanceForType() { return org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.getDefaultInstance(); }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection getDefaultInstanceForType() { return org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection.getDefaultInstance(); }
public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
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; }
public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
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; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection prototype) {
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection buildPartial() { org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection result = new org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.numEntry_ = numEntry_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection build() { org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } 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, numEntry_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }