Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Generated by protokt version 1.0.0-alpha.8. Do not modify.
// Source: google/api/distribution.proto
@file:Suppress("DEPRECATION")
package protokt.v1.google.api
import protokt.v1.AbstractKtDeserializer
import protokt.v1.AbstractKtMessage
import protokt.v1.Collections.copyList
import protokt.v1.Collections.unmodifiableList
import protokt.v1.KtBuilderDsl
import protokt.v1.KtMessageDeserializer
import protokt.v1.KtMessageSerializer
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.google.protobuf.Timestamp
import kotlin.Boolean
import kotlin.Double
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
import kotlin.jvm.JvmStatic
import com.toasttab.protokt.rt.KtGeneratedMessage as RtKtGeneratedMessage
import kotlin.Any as KotlinAny
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage
import protokt.v1.google.protobuf.Any as ProtobufAny
/**
* `Distribution` contains summary statistics for a population of values. It optionally contains a
* histogram representing the distribution of those values across a set of buckets.
*
* The summary statistics are the count, mean, sum of the squared deviation from the mean, the
* minimum, and the maximum of the set of population of values. The histogram is based on a sequence of
* buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are
* given either explicitly or by formulas for buckets of fixed or exponentially increasing widths.
*
* Although it is not forbidden, it is generally a bad idea to include non-finite values
* (infinities or NaNs) in the population of values, as this will render the `mean` and
* `sum_of_squared_deviation` fields meaningless.
*/
@V1KtGeneratedMessage("google.api.Distribution")
@RtKtGeneratedMessage("google.api.Distribution")
public class Distribution private constructor(
/**
* The number of values in the population. Must be non-negative. This value must equal the sum of
* the values in `bucket_counts` if a histogram is provided.
*/
public val count: Long,
/**
* The arithmetic mean of the values in the population. If `count` is zero then this field must be
* zero.
*/
public val mean: Double,
/**
* The sum of squared deviations from the mean of the values in the population. For values x_i
* this is:
*
* Sum[i=1..n]((x_i - mean)^2)
*
* Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition describes Welford's
* method for accumulating this sum in one pass.
*
* If `count` is zero then this field must be zero.
*/
public val sumOfSquaredDeviation: Double,
/**
* If specified, contains the range of the population values. The field must not be present if the
* `count` is zero.
*/
public val range: Range?,
/**
* Defines the histogram bucket boundaries. If the distribution does not contain a histogram, then
* omit this field.
*/
public val bucketOptions: BucketOptions?,
/**
* The number of values in each bucket of the histogram, as described in `bucket_options`. If the
* distribution does not have a histogram, then omit this field. If there is a histogram, then the
* sum of the values in `bucket_counts` must equal the value in the `count` field of the
* distribution.
*
* If present, `bucket_counts` should contain N values, where N is the number of buckets
* specified in `bucket_options`. If you supply fewer than N values, the remaining values are assumed
* to be 0.
*
* The order of the values in `bucket_counts` follows the bucket numbering schemes described for
* the three bucket types. The first value must be the count for the underflow bucket (number 0). The
* next N-2 values are the counts for the finite buckets (number 1 through N-2). The N'th value in
* `bucket_counts` is the count for the overflow bucket (number N-1).
*/
public val bucketCounts: List,
/**
* Must be in increasing order of `value` field.
*/
public val exemplars: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (count != 0L) {
result += sizeOf(8u) + sizeOf(count)
}
if (mean != 0.0) {
result += sizeOf(17u) + 8
}
if (sumOfSquaredDeviation != 0.0) {
result += sizeOf(25u) + 8
}
if (range != null) {
result += sizeOf(34u) + sizeOf(range)
}
if (bucketOptions != null) {
result += sizeOf(50u) + sizeOf(bucketOptions)
}
if (bucketCounts.isNotEmpty()) {
result += sizeOf(58u) + bucketCounts.sumOf { sizeOf(it) }.let { it + sizeOf(it.toUInt()) }
}
if (exemplars.isNotEmpty()) {
result += (sizeOf(82u) * exemplars.size) + exemplars.sumOf { sizeOf(it) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (count != 0L) {
serializer.writeTag(8u).write(count)
}
if (mean != 0.0) {
serializer.writeTag(17u).write(mean)
}
if (sumOfSquaredDeviation != 0.0) {
serializer.writeTag(25u).write(sumOfSquaredDeviation)
}
if (range != null) {
serializer.writeTag(34u).write(range)
}
if (bucketOptions != null) {
serializer.writeTag(50u).write(bucketOptions)
}
if (bucketCounts.isNotEmpty()) {
serializer.writeTag(58u).writeUInt32(bucketCounts.sumOf { sizeOf(it) }.toUInt())
bucketCounts.forEach { serializer.write(it) }
}
exemplars.forEach { serializer.writeTag(82u).write(it) }
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Distribution &&
other.count == count &&
other.mean == mean &&
other.sumOfSquaredDeviation == sumOfSquaredDeviation &&
other.range == range &&
other.bucketOptions == bucketOptions &&
other.bucketCounts == bucketCounts &&
other.exemplars == exemplars &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + count.hashCode()
result = 31 * result + mean.hashCode()
result = 31 * result + sumOfSquaredDeviation.hashCode()
result = 31 * result + range.hashCode()
result = 31 * result + bucketOptions.hashCode()
result = 31 * result + bucketCounts.hashCode()
result = 31 * result + exemplars.hashCode()
return result
}
override fun toString(): String =
"Distribution(" +
"count=$count, " +
"mean=$mean, " +
"sumOfSquaredDeviation=$sumOfSquaredDeviation, " +
"range=$range, " +
"bucketOptions=$bucketOptions, " +
"bucketCounts=$bucketCounts, " +
"exemplars=$exemplars" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Distribution =
Builder().apply {
count = [email protected]
mean = [email protected]
sumOfSquaredDeviation = [email protected]
range = [email protected]
bucketOptions = [email protected]
bucketCounts = [email protected]
exemplars = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var count: Long = 0L
public var mean: Double = 0.0
public var sumOfSquaredDeviation: Double = 0.0
public var range: Range? = null
public var bucketOptions: BucketOptions? = null
public var bucketCounts: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var exemplars: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Distribution =
Distribution(
count,
mean,
sumOfSquaredDeviation,
range,
bucketOptions,
unmodifiableList(bucketCounts),
unmodifiableList(exemplars),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Distribution {
var count = 0L
var mean = 0.0
var sumOfSquaredDeviation = 0.0
var range: Range? = null
var bucketOptions: BucketOptions? = null
var bucketCounts: MutableList? = null
var exemplars: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Distribution(
count,
mean,
sumOfSquaredDeviation,
range,
bucketOptions,
unmodifiableList(bucketCounts),
unmodifiableList(exemplars),
UnknownFieldSet.from(unknownFields)
)
8 -> count = deserializer.readInt64()
17 -> mean = deserializer.readDouble()
25 -> sumOfSquaredDeviation = deserializer.readDouble()
34 -> range = deserializer.readMessage(Range)
50 -> bucketOptions = deserializer.readMessage(BucketOptions)
56 ->
bucketCounts =
(bucketCounts ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readInt64())
}
}
58 ->
bucketCounts =
(bucketCounts ?: mutableListOf()).apply {
deserializer.readRepeated(true) {
add(deserializer.readInt64())
}
}
82 ->
exemplars =
(exemplars ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(Exemplar))
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Distribution = Builder().apply(dsl).build()
}
/**
* The range of the population values.
*/
@V1KtGeneratedMessage("google.api.Range")
@RtKtGeneratedMessage("google.api.Range")
public class Range private constructor(
/**
* The minimum of the population values.
*/
public val min: Double,
/**
* The maximum of the population values.
*/
public val max: Double,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (min != 0.0) {
result += sizeOf(9u) + 8
}
if (max != 0.0) {
result += sizeOf(17u) + 8
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (min != 0.0) {
serializer.writeTag(9u).write(min)
}
if (max != 0.0) {
serializer.writeTag(17u).write(max)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Range &&
other.min == min &&
other.max == max &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + min.hashCode()
result = 31 * result + max.hashCode()
return result
}
override fun toString(): String =
"Range(" +
"min=$min, " +
"max=$max" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Range =
Builder().apply {
min = [email protected]
max = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var min: Double = 0.0
public var max: Double = 0.0
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Range =
Range(
min,
max,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Range {
var min = 0.0
var max = 0.0
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Range(
min,
max,
UnknownFieldSet.from(unknownFields)
)
9 -> min = deserializer.readDouble()
17 -> max = deserializer.readDouble()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Range = Builder().apply(dsl).build()
}
}
/**
* `BucketOptions` describes the bucket boundaries used to create a histogram for the
* distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can
* be specified explicitly. `BucketOptions` does not include the number of values in each bucket.
*
* A bucket has an inclusive lower bound and exclusive upper bound for the values that are
* counted for that bucket. The upper bound of a bucket must be strictly greater than the lower
* bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0),
* zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The
* buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of
* bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow
* bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets
* are so-called because both bounds are finite.
*/
@V1KtGeneratedMessage("google.api.BucketOptions")
@RtKtGeneratedMessage("google.api.BucketOptions")
public class BucketOptions private constructor(
/**
* Exactly one of these three fields must be set.
*/
public val options: Options?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
when (options) {
is Options.LinearBuckets ->
result += sizeOf(10u) + sizeOf(options.linearBuckets)
is Options.ExponentialBuckets ->
result += sizeOf(18u) + sizeOf(options.exponentialBuckets)
is Options.ExplicitBuckets ->
result += sizeOf(26u) + sizeOf(options.explicitBuckets)
null -> Unit
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
when (options) {
is Options.LinearBuckets ->
serializer.writeTag(10u).write(options.linearBuckets)
is Options.ExponentialBuckets ->
serializer.writeTag(18u).write(options.exponentialBuckets)
is Options.ExplicitBuckets ->
serializer.writeTag(26u).write(options.explicitBuckets)
null -> Unit
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is BucketOptions &&
other.options == options &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + options.hashCode()
return result
}
override fun toString(): String =
"BucketOptions(" +
"options=$options" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): BucketOptions =
Builder().apply {
options = [email protected]
unknownFields = [email protected]
builder()
}.build()
public sealed class Options {
/**
* The linear bucket.
*/
public data class LinearBuckets(
public val linearBuckets: Linear
) : Options()
/**
* The exponential buckets.
*/
public data class ExponentialBuckets(
public val exponentialBuckets: Exponential
) : Options()
/**
* The explicit buckets.
*/
public data class ExplicitBuckets(
public val explicitBuckets: Explicit
) : Options()
}
@KtBuilderDsl
public class Builder {
public var options: Options? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): BucketOptions =
BucketOptions(
options,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): BucketOptions {
var options: Options? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return BucketOptions(
options,
UnknownFieldSet.from(unknownFields)
)
10 -> options = Options.LinearBuckets(deserializer.readMessage(Linear))
18 -> options = Options.ExponentialBuckets(deserializer.readMessage(Exponential))
26 -> options = Options.ExplicitBuckets(deserializer.readMessage(Explicit))
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): BucketOptions = Builder().apply(dsl).build()
}
/**
* Specifies a linear sequence of buckets that all have the same width (except overflow and
* underflow). Each bucket represents a constant absolute uncertainty on the specific value in the
* bucket.
*
* There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the following boundaries:
*
* Upper bound (0 <= i < N-1): offset + (width * i).
*
* Lower bound (1 <= i < N): offset + (width * (i - 1)).
*/
@V1KtGeneratedMessage("google.api.Linear")
@RtKtGeneratedMessage("google.api.Linear")
public class Linear private constructor(
/**
* Must be greater than 0.
*/
public val numFiniteBuckets: Int,
/**
* Must be greater than 0.
*/
public val width: Double,
/**
* Lower bound of the first bucket.
*/
public val offset: Double,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (numFiniteBuckets != 0) {
result += sizeOf(8u) + sizeOf(numFiniteBuckets)
}
if (width != 0.0) {
result += sizeOf(17u) + 8
}
if (offset != 0.0) {
result += sizeOf(25u) + 8
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (numFiniteBuckets != 0) {
serializer.writeTag(8u).write(numFiniteBuckets)
}
if (width != 0.0) {
serializer.writeTag(17u).write(width)
}
if (offset != 0.0) {
serializer.writeTag(25u).write(offset)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Linear &&
other.numFiniteBuckets == numFiniteBuckets &&
other.width == width &&
other.offset == offset &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + numFiniteBuckets.hashCode()
result = 31 * result + width.hashCode()
result = 31 * result + offset.hashCode()
return result
}
override fun toString(): String =
"Linear(" +
"numFiniteBuckets=$numFiniteBuckets, " +
"width=$width, " +
"offset=$offset" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Linear =
Builder().apply {
numFiniteBuckets = [email protected]
width = [email protected]
offset = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var numFiniteBuckets: Int = 0
public var width: Double = 0.0
public var offset: Double = 0.0
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Linear =
Linear(
numFiniteBuckets,
width,
offset,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Linear {
var numFiniteBuckets = 0
var width = 0.0
var offset = 0.0
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Linear(
numFiniteBuckets,
width,
offset,
UnknownFieldSet.from(unknownFields)
)
8 -> numFiniteBuckets = deserializer.readInt32()
17 -> width = deserializer.readDouble()
25 -> offset = deserializer.readDouble()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Linear = Builder().apply(dsl).build()
}
}
/**
* Specifies an exponential sequence of buckets that have a width that is proportional to the
* value of the lower bound. Each bucket represents a constant relative uncertainty on a specific
* value in the bucket.
*
* There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the following boundaries:
*
* Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
*
* Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
*/
@V1KtGeneratedMessage("google.api.Exponential")
@RtKtGeneratedMessage("google.api.Exponential")
public class Exponential private constructor(
/**
* Must be greater than 0.
*/
public val numFiniteBuckets: Int,
/**
* Must be greater than 1.
*/
public val growthFactor: Double,
/**
* Must be greater than 0.
*/
public val scale: Double,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (numFiniteBuckets != 0) {
result += sizeOf(8u) + sizeOf(numFiniteBuckets)
}
if (growthFactor != 0.0) {
result += sizeOf(17u) + 8
}
if (scale != 0.0) {
result += sizeOf(25u) + 8
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (numFiniteBuckets != 0) {
serializer.writeTag(8u).write(numFiniteBuckets)
}
if (growthFactor != 0.0) {
serializer.writeTag(17u).write(growthFactor)
}
if (scale != 0.0) {
serializer.writeTag(25u).write(scale)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Exponential &&
other.numFiniteBuckets == numFiniteBuckets &&
other.growthFactor == growthFactor &&
other.scale == scale &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + numFiniteBuckets.hashCode()
result = 31 * result + growthFactor.hashCode()
result = 31 * result + scale.hashCode()
return result
}
override fun toString(): String =
"Exponential(" +
"numFiniteBuckets=$numFiniteBuckets, " +
"growthFactor=$growthFactor, " +
"scale=$scale" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Exponential =
Builder().apply {
numFiniteBuckets = [email protected]
growthFactor = [email protected]
scale = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var numFiniteBuckets: Int = 0
public var growthFactor: Double = 0.0
public var scale: Double = 0.0
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Exponential =
Exponential(
numFiniteBuckets,
growthFactor,
scale,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Exponential {
var numFiniteBuckets = 0
var growthFactor = 0.0
var scale = 0.0
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Exponential(
numFiniteBuckets,
growthFactor,
scale,
UnknownFieldSet.from(unknownFields)
)
8 -> numFiniteBuckets = deserializer.readInt32()
17 -> growthFactor = deserializer.readDouble()
25 -> scale = deserializer.readDouble()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Exponential = Builder().apply(dsl).build()
}
}
/**
* Specifies a set of buckets with arbitrary widths.
*
* There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following boundaries:
*
* Upper bound (0 <= i < N-1): bounds[i] Lower bound (1 <= i < N); bounds[i -
* 1]
*
* The `bounds` field must contain at least one element. If `bounds` has only one element, then
* there are no finite buckets, and that single element is the common boundary of the overflow and
* underflow buckets.
*/
@V1KtGeneratedMessage("google.api.Explicit")
@RtKtGeneratedMessage("google.api.Explicit")
public class Explicit private constructor(
/**
* The values must be monotonically increasing.
*/
public val bounds: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (bounds.isNotEmpty()) {
result += sizeOf(10u) + ((bounds.size * 8)).let { it + sizeOf(it.toUInt()) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (bounds.isNotEmpty()) {
serializer.writeTag(10u).writeUInt32(((bounds.size * 8)).toUInt())
bounds.forEach { serializer.write(it) }
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Explicit &&
other.bounds == bounds &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + bounds.hashCode()
return result
}
override fun toString(): String =
"Explicit(" +
"bounds=$bounds" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Explicit =
Builder().apply {
bounds = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var bounds: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Explicit =
Explicit(
unmodifiableList(bounds),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Explicit {
var bounds: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Explicit(
unmodifiableList(bounds),
UnknownFieldSet.from(unknownFields)
)
9 ->
bounds =
(bounds ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readDouble())
}
}
10 ->
bounds =
(bounds ?: mutableListOf()).apply {
deserializer.readRepeated(true) {
add(deserializer.readDouble())
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Explicit = Builder().apply(dsl).build()
}
}
}
/**
* Exemplars are example points that may be used to annotate aggregated distribution values. They
* are metadata that gives information about a particular value added to a Distribution bucket, such
* as a trace ID that was active when a value was added. They may contain further information, such
* as a example values and timestamps, origin, etc.
*/
@V1KtGeneratedMessage("google.api.Exemplar")
@RtKtGeneratedMessage("google.api.Exemplar")
public class Exemplar private constructor(
/**
* Value of the exemplar point. This value determines to which bucket the exemplar belongs.
*/
public val `value`: Double,
/**
* The observation (sampling) time of the above value.
*/
public val timestamp: Timestamp?,
/**
* Contextual information about the example value. Examples are:
*
* Trace: type.googleapis.com/google.monitoring.v3.SpanContext
*
* Literal string: type.googleapis.com/google.protobuf.StringValue
*
* Labels dropped during aggregation:
* type.googleapis.com/google.monitoring.v3.DroppedLabels
*
* There may be only a single attachment of any given message type in a single exemplar, and
* this is enforced by the system.
*/
public val attachments: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (`value` != 0.0) {
result += sizeOf(9u) + 8
}
if (timestamp != null) {
result += sizeOf(18u) + sizeOf(timestamp)
}
if (attachments.isNotEmpty()) {
result += (sizeOf(26u) * attachments.size) + attachments.sumOf { sizeOf(it) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (`value` != 0.0) {
serializer.writeTag(9u).write(`value`)
}
if (timestamp != null) {
serializer.writeTag(18u).write(timestamp)
}
attachments.forEach { serializer.writeTag(26u).write(it) }
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is Exemplar &&
other.`value` == `value` &&
other.timestamp == timestamp &&
other.attachments == attachments &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + `value`.hashCode()
result = 31 * result + timestamp.hashCode()
result = 31 * result + attachments.hashCode()
return result
}
override fun toString(): String =
"Exemplar(" +
"`value`=$`value`, " +
"timestamp=$timestamp, " +
"attachments=$attachments" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Exemplar =
Builder().apply {
`value` = this@Exemplar.`value`
timestamp = [email protected]
attachments = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var `value`: Double = 0.0
public var timestamp: Timestamp? = null
public var attachments: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Exemplar =
Exemplar(
`value`,
timestamp,
unmodifiableList(attachments),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): Exemplar {
var `value` = 0.0
var timestamp: Timestamp? = null
var attachments: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return Exemplar(
`value`,
timestamp,
unmodifiableList(attachments),
UnknownFieldSet.from(unknownFields)
)
9 -> `value` = deserializer.readDouble()
18 -> timestamp = deserializer.readMessage(Timestamp)
26 ->
attachments =
(attachments ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(ProtobufAny))
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Exemplar = Builder().apply(dsl).build()
}
}
}