All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.allocator.HeartbeatMessage.kt Maven / Gradle / Ivy

// Code generated by Wire protocol buffer compiler, do not edit.
// Source: allocator.HeartbeatMessage in allocator/hub_allocator.proto
package allocator

import com.squareup.wire.FieldEncoding
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.ProtoReader
import com.squareup.wire.ProtoWriter
import com.squareup.wire.ReverseProtoWriter
import com.squareup.wire.Syntax.PROTO_3
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.AssertionError
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.DeprecationLevel
import kotlin.Int
import kotlin.Long
import kotlin.Nothing
import kotlin.String
import kotlin.Unit
import okio.ByteString

/**
 * *****************************************************************************************
 * *********************************** Message Requests ************************************
 * *****************************************************************************************
 */
public class HeartbeatMessage(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#INT32",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "maxCapacity",
  )
  public val max_capacity: Int = 0,
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#INT32",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "currentUsageCapacity",
  )
  public val current_usage_capacity: Int = 0,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val region: String = "",
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
  )
  public val endpoint: String = "",
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @Deprecated(
    message = "Shouldn't be used in Kotlin",
    level = DeprecationLevel.HIDDEN,
  )
  public override fun newBuilder(): Nothing = throw
      AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is HeartbeatMessage) return false
    if (unknownFields != other.unknownFields) return false
    if (max_capacity != other.max_capacity) return false
    if (current_usage_capacity != other.current_usage_capacity) return false
    if (region != other.region) return false
    if (endpoint != other.endpoint) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + max_capacity.hashCode()
      result = result * 37 + current_usage_capacity.hashCode()
      result = result * 37 + region.hashCode()
      result = result * 37 + endpoint.hashCode()
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    result += """max_capacity=$max_capacity"""
    result += """current_usage_capacity=$current_usage_capacity"""
    result += """region=${sanitize(region)}"""
    result += """endpoint=${sanitize(endpoint)}"""
    return result.joinToString(prefix = "HeartbeatMessage{", separator = ", ", postfix = "}")
  }

  public fun copy(
    max_capacity: Int = this.max_capacity,
    current_usage_capacity: Int = this.current_usage_capacity,
    region: String = this.region,
    endpoint: String = this.endpoint,
    unknownFields: ByteString = this.unknownFields,
  ): HeartbeatMessage = HeartbeatMessage(max_capacity, current_usage_capacity, region, endpoint,
      unknownFields)

  public companion object {
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      HeartbeatMessage::class, 
      "type.googleapis.com/allocator.HeartbeatMessage", 
      PROTO_3, 
      null, 
      "allocator/hub_allocator.proto"
    ) {
      public override fun encodedSize(`value`: HeartbeatMessage): Int {
        var size = value.unknownFields.size
        if (value.max_capacity != 0) size += ProtoAdapter.INT32.encodedSizeWithTag(1,
            value.max_capacity)
        if (value.current_usage_capacity != 0) size += ProtoAdapter.INT32.encodedSizeWithTag(2,
            value.current_usage_capacity)
        if (value.region != "") size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.region)
        if (value.endpoint != "") size += ProtoAdapter.STRING.encodedSizeWithTag(4, value.endpoint)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: HeartbeatMessage): Unit {
        if (value.max_capacity != 0) ProtoAdapter.INT32.encodeWithTag(writer, 1, value.max_capacity)
        if (value.current_usage_capacity != 0) ProtoAdapter.INT32.encodeWithTag(writer, 2,
            value.current_usage_capacity)
        if (value.region != "") ProtoAdapter.STRING.encodeWithTag(writer, 3, value.region)
        if (value.endpoint != "") ProtoAdapter.STRING.encodeWithTag(writer, 4, value.endpoint)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: HeartbeatMessage): Unit {
        writer.writeBytes(value.unknownFields)
        if (value.endpoint != "") ProtoAdapter.STRING.encodeWithTag(writer, 4, value.endpoint)
        if (value.region != "") ProtoAdapter.STRING.encodeWithTag(writer, 3, value.region)
        if (value.current_usage_capacity != 0) ProtoAdapter.INT32.encodeWithTag(writer, 2,
            value.current_usage_capacity)
        if (value.max_capacity != 0) ProtoAdapter.INT32.encodeWithTag(writer, 1, value.max_capacity)
      }

      public override fun decode(reader: ProtoReader): HeartbeatMessage {
        var max_capacity: Int = 0
        var current_usage_capacity: Int = 0
        var region: String = ""
        var endpoint: String = ""
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> max_capacity = ProtoAdapter.INT32.decode(reader)
            2 -> current_usage_capacity = ProtoAdapter.INT32.decode(reader)
            3 -> region = ProtoAdapter.STRING.decode(reader)
            4 -> endpoint = ProtoAdapter.STRING.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return HeartbeatMessage(
          max_capacity = max_capacity,
          current_usage_capacity = current_usage_capacity,
          region = region,
          endpoint = endpoint,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: HeartbeatMessage): HeartbeatMessage = value.copy(
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy