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

io.opencensus.proto.agent.common.v1.ProcessIdentifier.scala Maven / Gradle / Ivy

There is a newer version: 1.23.0-dev-f04150-1
Show newest version
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package io.opencensus.proto.agent.common.v1

/** Identifier that uniquely identifies a process within a VM/container.
  *
  * @param hostName
  *   The host name. Usually refers to the machine/container name.
  *   For example: os.Hostname() in Go, socket.gethostname() in Python.
  * @param pid
  *   Process id.
  * @param startTimestamp
  *   Start time of this ProcessIdentifier. Represented in epoch time.
  */
@SerialVersionUID(0L)
final case class ProcessIdentifier(
    hostName: _root_.scala.Predef.String = "",
    pid: _root_.scala.Int = 0,
    startTimestamp: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp] = _root_.scala.None,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ProcessIdentifier] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = hostName
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = pid
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(2, __value)
        }
      };
      if (startTimestamp.isDefined) {
        val __value = startTimestamp.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = hostName
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = pid
        if (__v != 0) {
          _output__.writeUInt32(2, __v)
        }
      };
      startTimestamp.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withHostName(__v: _root_.scala.Predef.String): ProcessIdentifier = copy(hostName = __v)
    def withPid(__v: _root_.scala.Int): ProcessIdentifier = copy(pid = __v)
    def getStartTimestamp: com.google.protobuf.timestamp.Timestamp = startTimestamp.getOrElse(com.google.protobuf.timestamp.Timestamp.defaultInstance)
    def clearStartTimestamp: ProcessIdentifier = copy(startTimestamp = _root_.scala.None)
    def withStartTimestamp(__v: com.google.protobuf.timestamp.Timestamp): ProcessIdentifier = copy(startTimestamp = Option(__v))
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = hostName
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = pid
          if (__t != 0) __t else null
        }
        case 3 => startTimestamp.orNull
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PString(hostName)
        case 2 => _root_.scalapb.descriptors.PInt(pid)
        case 3 => startTimestamp.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.opencensus.proto.agent.common.v1.ProcessIdentifier.type = io.opencensus.proto.agent.common.v1.ProcessIdentifier
    // @@protoc_insertion_point(GeneratedMessage[opencensus.proto.agent.common.v1.ProcessIdentifier])
}

object ProcessIdentifier extends scalapb.GeneratedMessageCompanion[io.opencensus.proto.agent.common.v1.ProcessIdentifier] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.opencensus.proto.agent.common.v1.ProcessIdentifier] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.opencensus.proto.agent.common.v1.ProcessIdentifier = {
    var __hostName: _root_.scala.Predef.String = ""
    var __pid: _root_.scala.Int = 0
    var __startTimestamp: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp] = _root_.scala.None
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __hostName = _input__.readStringRequireUtf8()
        case 16 =>
          __pid = _input__.readUInt32()
        case 26 =>
          __startTimestamp = Option(__startTimestamp.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.timestamp.Timestamp](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.opencensus.proto.agent.common.v1.ProcessIdentifier(
        hostName = __hostName,
        pid = __pid,
        startTimestamp = __startTimestamp,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.opencensus.proto.agent.common.v1.ProcessIdentifier] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      io.opencensus.proto.agent.common.v1.ProcessIdentifier(
        hostName = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        pid = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0),
        startTimestamp = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.timestamp.Timestamp]])
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = CommonProto.javaDescriptor.getMessageTypes().get(1)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = CommonProto.scalaDescriptor.messages(1)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 3 => __out = com.google.protobuf.timestamp.Timestamp
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = io.opencensus.proto.agent.common.v1.ProcessIdentifier(
    hostName = "",
    pid = 0,
    startTimestamp = _root_.scala.None
  )
  implicit class ProcessIdentifierLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.opencensus.proto.agent.common.v1.ProcessIdentifier]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.opencensus.proto.agent.common.v1.ProcessIdentifier](_l) {
    def hostName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.hostName)((c_, f_) => c_.copy(hostName = f_))
    def pid: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.pid)((c_, f_) => c_.copy(pid = f_))
    def startTimestamp: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.timestamp.Timestamp] = field(_.getStartTimestamp)((c_, f_) => c_.copy(startTimestamp = Option(f_)))
    def optionalStartTimestamp: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.timestamp.Timestamp]] = field(_.startTimestamp)((c_, f_) => c_.copy(startTimestamp = f_))
  }
  final val HOST_NAME_FIELD_NUMBER = 1
  final val PID_FIELD_NUMBER = 2
  final val START_TIMESTAMP_FIELD_NUMBER = 3
  def of(
    hostName: _root_.scala.Predef.String,
    pid: _root_.scala.Int,
    startTimestamp: _root_.scala.Option[com.google.protobuf.timestamp.Timestamp]
  ): _root_.io.opencensus.proto.agent.common.v1.ProcessIdentifier = _root_.io.opencensus.proto.agent.common.v1.ProcessIdentifier(
    hostName,
    pid,
    startTimestamp
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[opencensus.proto.agent.common.v1.ProcessIdentifier])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy