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(_ROLE_FIELD_DESC);
  oprot.writeI32(this.role);
  oprot.writeFieldEnd();
  if (this.host != null) {
    oprot.writeFieldBegin(_HOST_FIELD_DESC);
    this.host?.write(oprot);
    oprot.writeFieldEnd();
  }
  oprot.writeFieldBegin(_CLUSTER_ID_FIELD_DESC);
  oprot.writeI64(this.cluster_id);
  oprot.writeFieldEnd();
  if (isSetLeader_partIds()) {
    if (this.leader_partIds != null) {
      oprot.writeFieldBegin(_LEADER_PART_IDS_FIELD_DESC);
      {
        oprot.writeMapBegin(
            new TMap(TType.I32, TType.LIST, this.leader_partIds?.length));
        for (var elem168 in this.leader_partIds?.keys ?? <int>[]) {
          oprot.writeI32(elem168);
          {
            oprot.writeListBegin(new TList(
                TType.STRUCT, this.leader_partIds?[elem168]?.length));
            for (var elem169
                in this.leader_partIds?[elem168] ?? <LeaderInfo>[]) {
              elem169.write(oprot);
            }
            oprot.writeListEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
  }
  if (this.git_info_sha != null) {
    oprot.writeFieldBegin(_GIT_INFO_SHA_FIELD_DESC);
    oprot.writeBinary(this.git_info_sha);
    oprot.writeFieldEnd();
  }
  if (isSetDisk_parts()) {
    if (this.disk_parts != null) {
      oprot.writeFieldBegin(_DISK_PARTS_FIELD_DESC);
      {
        oprot.writeMapBegin(
            new TMap(TType.I32, TType.MAP, this.disk_parts?.length));
        for (var elem171 in this.disk_parts?.keys ?? <int>[]) {
          oprot.writeI32(elem171);
          {
            oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT,
                this.disk_parts?[elem171]?.length));
            for (var elem173
                in this.disk_parts?[elem171]?.keys ?? <Int8List>[]) {
              oprot.writeBinary(elem173);
              this.disk_parts?[elem171]?[elem173]?.write(oprot);
            }
            oprot.writeMapEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
  }
  if (isSetDir()) {
    if (this.dir != null) {
      oprot.writeFieldBegin(_DIR_FIELD_DESC);
      this.dir?.write(oprot);
      oprot.writeFieldEnd();
    }
  }
  if (isSetVersion()) {
    if (this.version != null) {
      oprot.writeFieldBegin(_VERSION_FIELD_DESC);
      oprot.writeBinary(this.version);
      oprot.writeFieldEnd();
    }
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}