write method

void write(
  1. TProtocol oprot
)
override

Writes the objects out to the oprot protocol.

Implementation

write(TProtocol oprot) {
  validate();

  oprot.writeStructBegin(_STRUCT_DESC);
  oprot.writeFieldBegin(_CODE_FIELD_DESC);
  oprot.writeI32(this.code);
  oprot.writeFieldEnd();
  if (this.leader != null) {
    oprot.writeFieldBegin(_LEADER_FIELD_DESC);
    this.leader?.write(oprot);
    oprot.writeFieldEnd();
  }
  if (this.parts != null) {
    oprot.writeFieldBegin(_PARTS_FIELD_DESC);
    {
      oprot
          .writeMapBegin(new TMap(TType.I32, TType.LIST, this.parts?.length));
      for (var elem144 in this.parts?.keys ?? <int>[]) {
        oprot.writeI32(elem144);
        {
          oprot.writeListBegin(
              new TList(TType.STRUCT, this.parts?[elem144]?.length));
          for (var elem145 in this.parts?[elem144] ?? <t_nebula.HostAddr>[]) {
            elem145.write(oprot);
          }
          oprot.writeListEnd();
        }
      }
      oprot.writeMapEnd();
    }
    oprot.writeFieldEnd();
  }
  if (isSetTerms()) {
    if (this.terms != null) {
      oprot.writeFieldBegin(_TERMS_FIELD_DESC);
      {
        oprot.writeMapBegin(
            new TMap(TType.I32, TType.I64, this.terms?.length));
        for (var elem147 in this.terms?.keys ?? <int>[]) {
          oprot.writeI32(elem147);
          oprot.writeI64(this.terms?[elem147]);
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}