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

com.slack.sgp.tracing.ListOfSpans.kt Maven / Gradle / Ivy

// Code generated by Wire protocol buffer compiler, do not edit.
// Source: trace.ListOfSpans in trace.proto
@file:Suppress("DEPRECATION")

package com.slack.sgp.tracing

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`.JvmField
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
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.Suppress
import kotlin.collections.List
import okio.ByteString

/**
 * List of spans is a message to send multiple spans in a single call.
 * Any tags specified in this call will be added to all the spans sent in this message.
 * If the list of spans is empty, this message will be ignored even if tags field is set.
 */
public class ListOfSpans(
  spans: List = emptyList(),
  tags: List = emptyList(),
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  /**
   * A list of spans.
   */
  @field:WireField(
    tag = 1,
    adapter = "com.slack.sgp.tracing.Span#ADAPTER",
    label = WireField.Label.REPEATED,
    schemaIndex = 0,
  )
  public val spans: List = immutableCopyOf("spans", spans)

  /**
   * A list of tags common to all the spans in this request.
   * All these tags will be added for all the spans sent in this request.
   * Sending common tags this way is more network efficient.
   */
  @field:WireField(
    tag = 2,
    adapter = "com.slack.sgp.tracing.KeyValue#ADAPTER",
    label = WireField.Label.REPEATED,
    schemaIndex = 1,
  )
  public val tags: List = immutableCopyOf("tags", tags)

  @Deprecated(
    message = "Shouldn't be used in Kotlin",
    level = DeprecationLevel.HIDDEN,
  )
  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")

  override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is ListOfSpans) return false
    if (unknownFields != other.unknownFields) return false
    if (spans != other.spans) return false
    if (tags != other.tags) return false
    return true
  }

  override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + spans.hashCode()
      result = result * 37 + tags.hashCode()
      super.hashCode = result
    }
    return result
  }

  override fun toString(): String {
    val result = mutableListOf()
    if (spans.isNotEmpty()) result += """spans=$spans"""
    if (tags.isNotEmpty()) result += """tags=$tags"""
    return result.joinToString(prefix = "ListOfSpans{", separator = ", ", postfix = "}")
  }

  public fun copy(
    spans: List = this.spans,
    tags: List = this.tags,
    unknownFields: ByteString = this.unknownFields,
  ): ListOfSpans = ListOfSpans(spans, tags, unknownFields)

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      ListOfSpans::class, 
      "type.googleapis.com/trace.ListOfSpans", 
      PROTO_3, 
      null, 
      "trace.proto"
    ) {
      override fun encodedSize(`value`: ListOfSpans): Int {
        var size = value.unknownFields.size
        size += Span.ADAPTER.asRepeated().encodedSizeWithTag(1, value.spans)
        size += KeyValue.ADAPTER.asRepeated().encodedSizeWithTag(2, value.tags)
        return size
      }

      override fun encode(writer: ProtoWriter, `value`: ListOfSpans) {
        Span.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.spans)
        KeyValue.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.tags)
        writer.writeBytes(value.unknownFields)
      }

      override fun encode(writer: ReverseProtoWriter, `value`: ListOfSpans) {
        writer.writeBytes(value.unknownFields)
        KeyValue.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.tags)
        Span.ADAPTER.asRepeated().encodeWithTag(writer, 1, value.spans)
      }

      override fun decode(reader: ProtoReader): ListOfSpans {
        val spans = mutableListOf()
        val tags = mutableListOf()
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> spans.add(Span.ADAPTER.decode(reader))
            2 -> tags.add(KeyValue.ADAPTER.decode(reader))
            else -> reader.readUnknownField(tag)
          }
        }
        return ListOfSpans(
          spans = spans,
          tags = tags,
          unknownFields = unknownFields
        )
      }

      override fun redact(`value`: ListOfSpans): ListOfSpans = value.copy(
        spans = value.spans.redactElements(Span.ADAPTER),
        tags = value.tags.redactElements(KeyValue.ADAPTER),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy