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

routerrpc.AprioriParameters.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package routerrpc

/** @param halfLifeSeconds
  *  
  *  The amount of time mission control will take to restore a penalized node
  *  or channel back to 50% success probability, expressed in seconds. Setting
  *  this value to a higher value will penalize failures for longer, making
  *  mission control less likely to route through nodes and channels that we
  *  have previously recorded failures for.
  * @param hopProbability
  *  
  *  The probability of success mission control should assign to hop in a route
  *  where it has no other information available. Higher values will make mission
  *  control more willing to try hops that we have no information about, lower
  *  values will discourage trying these hops.
  * @param weight
  *  
  *  The importance that mission control should place on historical results,
  *  expressed as a value in [0;1]. Setting this value to 1 will ignore all
  *  historical payments and just use the hop probability to assess the
  *  probability of success for each hop. A zero value ignores hop probability
  *  completely and relies entirely on historical results, unless none are
  *  available.
  * @param capacityFraction
  *  
  *  The fraction of a channel's capacity that we consider to have liquidity. For
  *  amounts that come close to or exceed the fraction, an additional penalty is
  *  applied. A value of 1.0 disables the capacity factor. Allowed values are in
  *  [0.75, 1.0].
  */
@SerialVersionUID(0L)
final case class AprioriParameters(
    halfLifeSeconds: _root_.scala.Long = 0L,
    hopProbability: _root_.scala.Double = 0.0,
    weight: _root_.scala.Double = 0.0,
    capacityFraction: _root_.scala.Double = 0.0,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[AprioriParameters] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = halfLifeSeconds
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
        }
      };
      
      {
        val __value = hopProbability
        if (__value != 0.0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeDoubleSize(2, __value)
        }
      };
      
      {
        val __value = weight
        if (__value != 0.0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeDoubleSize(3, __value)
        }
      };
      
      {
        val __value = capacityFraction
        if (__value != 0.0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeDoubleSize(4, __value)
        }
      };
      __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 = halfLifeSeconds
        if (__v != 0L) {
          _output__.writeUInt64(1, __v)
        }
      };
      {
        val __v = hopProbability
        if (__v != 0.0) {
          _output__.writeDouble(2, __v)
        }
      };
      {
        val __v = weight
        if (__v != 0.0) {
          _output__.writeDouble(3, __v)
        }
      };
      {
        val __v = capacityFraction
        if (__v != 0.0) {
          _output__.writeDouble(4, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withHalfLifeSeconds(__v: _root_.scala.Long): AprioriParameters = copy(halfLifeSeconds = __v)
    def withHopProbability(__v: _root_.scala.Double): AprioriParameters = copy(hopProbability = __v)
    def withWeight(__v: _root_.scala.Double): AprioriParameters = copy(weight = __v)
    def withCapacityFraction(__v: _root_.scala.Double): AprioriParameters = copy(capacityFraction = __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 = halfLifeSeconds
          if (__t != 0L) __t else null
        }
        case 2 => {
          val __t = hopProbability
          if (__t != 0.0) __t else null
        }
        case 3 => {
          val __t = weight
          if (__t != 0.0) __t else null
        }
        case 4 => {
          val __t = capacityFraction
          if (__t != 0.0) __t else null
        }
      }
    }
    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.PLong(halfLifeSeconds)
        case 2 => _root_.scalapb.descriptors.PDouble(hopProbability)
        case 3 => _root_.scalapb.descriptors.PDouble(weight)
        case 4 => _root_.scalapb.descriptors.PDouble(capacityFraction)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: routerrpc.AprioriParameters.type = routerrpc.AprioriParameters
    // @@protoc_insertion_point(GeneratedMessage[routerrpc.AprioriParameters])
}

object AprioriParameters extends scalapb.GeneratedMessageCompanion[routerrpc.AprioriParameters] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[routerrpc.AprioriParameters] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): routerrpc.AprioriParameters = {
    var __halfLifeSeconds: _root_.scala.Long = 0L
    var __hopProbability: _root_.scala.Double = 0.0
    var __weight: _root_.scala.Double = 0.0
    var __capacityFraction: _root_.scala.Double = 0.0
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __halfLifeSeconds = _input__.readUInt64()
        case 17 =>
          __hopProbability = _input__.readDouble()
        case 25 =>
          __weight = _input__.readDouble()
        case 33 =>
          __capacityFraction = _input__.readDouble()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    routerrpc.AprioriParameters(
        halfLifeSeconds = __halfLifeSeconds,
        hopProbability = __hopProbability,
        weight = __weight,
        capacityFraction = __capacityFraction,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[routerrpc.AprioriParameters] = _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.")
      routerrpc.AprioriParameters(
        halfLifeSeconds = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        hopProbability = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Double]).getOrElse(0.0),
        weight = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Double]).getOrElse(0.0),
        capacityFraction = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Double]).getOrElse(0.0)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = RouterProto.javaDescriptor.getMessageTypes().get(21)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = RouterProto.scalaDescriptor.messages(21)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  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 = routerrpc.AprioriParameters(
    halfLifeSeconds = 0L,
    hopProbability = 0.0,
    weight = 0.0,
    capacityFraction = 0.0
  )
  implicit class AprioriParametersLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, routerrpc.AprioriParameters]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, routerrpc.AprioriParameters](_l) {
    def halfLifeSeconds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.halfLifeSeconds)((c_, f_) => c_.copy(halfLifeSeconds = f_))
    def hopProbability: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.hopProbability)((c_, f_) => c_.copy(hopProbability = f_))
    def weight: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.weight)((c_, f_) => c_.copy(weight = f_))
    def capacityFraction: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.capacityFraction)((c_, f_) => c_.copy(capacityFraction = f_))
  }
  final val HALF_LIFE_SECONDS_FIELD_NUMBER = 1
  final val HOP_PROBABILITY_FIELD_NUMBER = 2
  final val WEIGHT_FIELD_NUMBER = 3
  final val CAPACITY_FRACTION_FIELD_NUMBER = 4
  def of(
    halfLifeSeconds: _root_.scala.Long,
    hopProbability: _root_.scala.Double,
    weight: _root_.scala.Double,
    capacityFraction: _root_.scala.Double
  ): _root_.routerrpc.AprioriParameters = _root_.routerrpc.AprioriParameters(
    halfLifeSeconds,
    hopProbability,
    weight,
    capacityFraction
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[routerrpc.AprioriParameters])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy