1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/tasks/v2/queue.proto 18 19 package com.google.cloud.tasks.v2; 20 21 /** 22 * 23 * 24 * <pre> 25 * Rate limits. 26 * This message determines the maximum rate that tasks can be dispatched by a 27 * queue, regardless of whether the dispatch is a first task attempt or a retry. 28 * Note: The debugging command, 29 * [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task even if 30 * the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits]. 31 * </pre> 32 * 33 * Protobuf type {@code google.cloud.tasks.v2.RateLimits} 34 */ 35 public final class RateLimits extends com.google.protobuf.GeneratedMessageV3 36 implements 37 // @@protoc_insertion_point(message_implements:google.cloud.tasks.v2.RateLimits) 38 RateLimitsOrBuilder { 39 private static final long serialVersionUID = 0L; 40 // Use RateLimits.newBuilder() to construct. RateLimits(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)41 private RateLimits(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 42 super(builder); 43 } 44 RateLimits()45 private RateLimits() {} 46 47 @java.lang.Override 48 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)49 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 50 return new RateLimits(); 51 } 52 53 @java.lang.Override getUnknownFields()54 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 55 return this.unknownFields; 56 } 57 getDescriptor()58 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 59 return com.google.cloud.tasks.v2.QueueProto 60 .internal_static_google_cloud_tasks_v2_RateLimits_descriptor; 61 } 62 63 @java.lang.Override 64 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()65 internalGetFieldAccessorTable() { 66 return com.google.cloud.tasks.v2.QueueProto 67 .internal_static_google_cloud_tasks_v2_RateLimits_fieldAccessorTable 68 .ensureFieldAccessorsInitialized( 69 com.google.cloud.tasks.v2.RateLimits.class, 70 com.google.cloud.tasks.v2.RateLimits.Builder.class); 71 } 72 73 public static final int MAX_DISPATCHES_PER_SECOND_FIELD_NUMBER = 1; 74 private double maxDispatchesPerSecond_ = 0D; 75 /** 76 * 77 * 78 * <pre> 79 * The maximum rate at which tasks are dispatched from this queue. 80 * If unspecified when the queue is created, Cloud Tasks will pick the 81 * default. 82 * * The maximum allowed value is 500. 83 * This field has the same meaning as 84 * [rate in 85 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). 86 * </pre> 87 * 88 * <code>double max_dispatches_per_second = 1;</code> 89 * 90 * @return The maxDispatchesPerSecond. 91 */ 92 @java.lang.Override getMaxDispatchesPerSecond()93 public double getMaxDispatchesPerSecond() { 94 return maxDispatchesPerSecond_; 95 } 96 97 public static final int MAX_BURST_SIZE_FIELD_NUMBER = 2; 98 private int maxBurstSize_ = 0; 99 /** 100 * 101 * 102 * <pre> 103 * Output only. The max burst size. 104 * Max burst size limits how fast tasks in queue are processed when 105 * many tasks are in the queue and the rate is high. This field 106 * allows the queue to have a high rate so processing starts shortly 107 * after a task is enqueued, but still limits resource usage when 108 * many tasks are enqueued in a short period of time. 109 * The [token bucket](https://wikipedia.org/wiki/Token_Bucket) 110 * algorithm is used to control the rate of task dispatches. Each 111 * queue has a token bucket that holds tokens, up to the maximum 112 * specified by `max_burst_size`. Each time a task is dispatched, a 113 * token is removed from the bucket. Tasks will be dispatched until 114 * the queue's bucket runs out of tokens. The bucket will be 115 * continuously refilled with new tokens based on 116 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 117 * Cloud Tasks will pick the value of `max_burst_size` based on the 118 * value of 119 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 120 * For queues that were created or updated using 121 * `queue.yaml/xml`, `max_burst_size` is equal to 122 * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). 123 * Since `max_burst_size` is output only, if 124 * [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a 125 * queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on 126 * the value of 127 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], 128 * regardless of whether 129 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] 130 * is updated. 131 * </pre> 132 * 133 * <code>int32 max_burst_size = 2;</code> 134 * 135 * @return The maxBurstSize. 136 */ 137 @java.lang.Override getMaxBurstSize()138 public int getMaxBurstSize() { 139 return maxBurstSize_; 140 } 141 142 public static final int MAX_CONCURRENT_DISPATCHES_FIELD_NUMBER = 3; 143 private int maxConcurrentDispatches_ = 0; 144 /** 145 * 146 * 147 * <pre> 148 * The maximum number of concurrent tasks that Cloud Tasks allows 149 * to be dispatched for this queue. After this threshold has been 150 * reached, Cloud Tasks stops dispatching tasks until the number of 151 * concurrent requests decreases. 152 * If unspecified when the queue is created, Cloud Tasks will pick the 153 * default. 154 * The maximum allowed value is 5,000. 155 * This field has the same meaning as 156 * [max_concurrent_requests in 157 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). 158 * </pre> 159 * 160 * <code>int32 max_concurrent_dispatches = 3;</code> 161 * 162 * @return The maxConcurrentDispatches. 163 */ 164 @java.lang.Override getMaxConcurrentDispatches()165 public int getMaxConcurrentDispatches() { 166 return maxConcurrentDispatches_; 167 } 168 169 private byte memoizedIsInitialized = -1; 170 171 @java.lang.Override isInitialized()172 public final boolean isInitialized() { 173 byte isInitialized = memoizedIsInitialized; 174 if (isInitialized == 1) return true; 175 if (isInitialized == 0) return false; 176 177 memoizedIsInitialized = 1; 178 return true; 179 } 180 181 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)182 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 183 if (java.lang.Double.doubleToRawLongBits(maxDispatchesPerSecond_) != 0) { 184 output.writeDouble(1, maxDispatchesPerSecond_); 185 } 186 if (maxBurstSize_ != 0) { 187 output.writeInt32(2, maxBurstSize_); 188 } 189 if (maxConcurrentDispatches_ != 0) { 190 output.writeInt32(3, maxConcurrentDispatches_); 191 } 192 getUnknownFields().writeTo(output); 193 } 194 195 @java.lang.Override getSerializedSize()196 public int getSerializedSize() { 197 int size = memoizedSize; 198 if (size != -1) return size; 199 200 size = 0; 201 if (java.lang.Double.doubleToRawLongBits(maxDispatchesPerSecond_) != 0) { 202 size += com.google.protobuf.CodedOutputStream.computeDoubleSize(1, maxDispatchesPerSecond_); 203 } 204 if (maxBurstSize_ != 0) { 205 size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, maxBurstSize_); 206 } 207 if (maxConcurrentDispatches_ != 0) { 208 size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, maxConcurrentDispatches_); 209 } 210 size += getUnknownFields().getSerializedSize(); 211 memoizedSize = size; 212 return size; 213 } 214 215 @java.lang.Override equals(final java.lang.Object obj)216 public boolean equals(final java.lang.Object obj) { 217 if (obj == this) { 218 return true; 219 } 220 if (!(obj instanceof com.google.cloud.tasks.v2.RateLimits)) { 221 return super.equals(obj); 222 } 223 com.google.cloud.tasks.v2.RateLimits other = (com.google.cloud.tasks.v2.RateLimits) obj; 224 225 if (java.lang.Double.doubleToLongBits(getMaxDispatchesPerSecond()) 226 != java.lang.Double.doubleToLongBits(other.getMaxDispatchesPerSecond())) return false; 227 if (getMaxBurstSize() != other.getMaxBurstSize()) return false; 228 if (getMaxConcurrentDispatches() != other.getMaxConcurrentDispatches()) return false; 229 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 230 return true; 231 } 232 233 @java.lang.Override hashCode()234 public int hashCode() { 235 if (memoizedHashCode != 0) { 236 return memoizedHashCode; 237 } 238 int hash = 41; 239 hash = (19 * hash) + getDescriptor().hashCode(); 240 hash = (37 * hash) + MAX_DISPATCHES_PER_SECOND_FIELD_NUMBER; 241 hash = 242 (53 * hash) 243 + com.google.protobuf.Internal.hashLong( 244 java.lang.Double.doubleToLongBits(getMaxDispatchesPerSecond())); 245 hash = (37 * hash) + MAX_BURST_SIZE_FIELD_NUMBER; 246 hash = (53 * hash) + getMaxBurstSize(); 247 hash = (37 * hash) + MAX_CONCURRENT_DISPATCHES_FIELD_NUMBER; 248 hash = (53 * hash) + getMaxConcurrentDispatches(); 249 hash = (29 * hash) + getUnknownFields().hashCode(); 250 memoizedHashCode = hash; 251 return hash; 252 } 253 parseFrom(java.nio.ByteBuffer data)254 public static com.google.cloud.tasks.v2.RateLimits parseFrom(java.nio.ByteBuffer data) 255 throws com.google.protobuf.InvalidProtocolBufferException { 256 return PARSER.parseFrom(data); 257 } 258 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)259 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 260 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 261 throws com.google.protobuf.InvalidProtocolBufferException { 262 return PARSER.parseFrom(data, extensionRegistry); 263 } 264 parseFrom(com.google.protobuf.ByteString data)265 public static com.google.cloud.tasks.v2.RateLimits parseFrom(com.google.protobuf.ByteString data) 266 throws com.google.protobuf.InvalidProtocolBufferException { 267 return PARSER.parseFrom(data); 268 } 269 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)270 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 271 com.google.protobuf.ByteString data, 272 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 273 throws com.google.protobuf.InvalidProtocolBufferException { 274 return PARSER.parseFrom(data, extensionRegistry); 275 } 276 parseFrom(byte[] data)277 public static com.google.cloud.tasks.v2.RateLimits parseFrom(byte[] data) 278 throws com.google.protobuf.InvalidProtocolBufferException { 279 return PARSER.parseFrom(data); 280 } 281 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)282 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 283 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 284 throws com.google.protobuf.InvalidProtocolBufferException { 285 return PARSER.parseFrom(data, extensionRegistry); 286 } 287 parseFrom(java.io.InputStream input)288 public static com.google.cloud.tasks.v2.RateLimits parseFrom(java.io.InputStream input) 289 throws java.io.IOException { 290 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 291 } 292 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)293 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 294 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 295 throws java.io.IOException { 296 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 297 PARSER, input, extensionRegistry); 298 } 299 parseDelimitedFrom(java.io.InputStream input)300 public static com.google.cloud.tasks.v2.RateLimits parseDelimitedFrom(java.io.InputStream input) 301 throws java.io.IOException { 302 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 303 } 304 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)305 public static com.google.cloud.tasks.v2.RateLimits parseDelimitedFrom( 306 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 307 throws java.io.IOException { 308 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 309 PARSER, input, extensionRegistry); 310 } 311 parseFrom( com.google.protobuf.CodedInputStream input)312 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 313 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 314 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 315 } 316 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)317 public static com.google.cloud.tasks.v2.RateLimits parseFrom( 318 com.google.protobuf.CodedInputStream input, 319 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 320 throws java.io.IOException { 321 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 322 PARSER, input, extensionRegistry); 323 } 324 325 @java.lang.Override newBuilderForType()326 public Builder newBuilderForType() { 327 return newBuilder(); 328 } 329 newBuilder()330 public static Builder newBuilder() { 331 return DEFAULT_INSTANCE.toBuilder(); 332 } 333 newBuilder(com.google.cloud.tasks.v2.RateLimits prototype)334 public static Builder newBuilder(com.google.cloud.tasks.v2.RateLimits prototype) { 335 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 336 } 337 338 @java.lang.Override toBuilder()339 public Builder toBuilder() { 340 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 341 } 342 343 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)344 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 345 Builder builder = new Builder(parent); 346 return builder; 347 } 348 /** 349 * 350 * 351 * <pre> 352 * Rate limits. 353 * This message determines the maximum rate that tasks can be dispatched by a 354 * queue, regardless of whether the dispatch is a first task attempt or a retry. 355 * Note: The debugging command, 356 * [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task even if 357 * the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits]. 358 * </pre> 359 * 360 * Protobuf type {@code google.cloud.tasks.v2.RateLimits} 361 */ 362 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 363 implements 364 // @@protoc_insertion_point(builder_implements:google.cloud.tasks.v2.RateLimits) 365 com.google.cloud.tasks.v2.RateLimitsOrBuilder { getDescriptor()366 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 367 return com.google.cloud.tasks.v2.QueueProto 368 .internal_static_google_cloud_tasks_v2_RateLimits_descriptor; 369 } 370 371 @java.lang.Override 372 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()373 internalGetFieldAccessorTable() { 374 return com.google.cloud.tasks.v2.QueueProto 375 .internal_static_google_cloud_tasks_v2_RateLimits_fieldAccessorTable 376 .ensureFieldAccessorsInitialized( 377 com.google.cloud.tasks.v2.RateLimits.class, 378 com.google.cloud.tasks.v2.RateLimits.Builder.class); 379 } 380 381 // Construct using com.google.cloud.tasks.v2.RateLimits.newBuilder() Builder()382 private Builder() {} 383 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)384 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 385 super(parent); 386 } 387 388 @java.lang.Override clear()389 public Builder clear() { 390 super.clear(); 391 bitField0_ = 0; 392 maxDispatchesPerSecond_ = 0D; 393 maxBurstSize_ = 0; 394 maxConcurrentDispatches_ = 0; 395 return this; 396 } 397 398 @java.lang.Override getDescriptorForType()399 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 400 return com.google.cloud.tasks.v2.QueueProto 401 .internal_static_google_cloud_tasks_v2_RateLimits_descriptor; 402 } 403 404 @java.lang.Override getDefaultInstanceForType()405 public com.google.cloud.tasks.v2.RateLimits getDefaultInstanceForType() { 406 return com.google.cloud.tasks.v2.RateLimits.getDefaultInstance(); 407 } 408 409 @java.lang.Override build()410 public com.google.cloud.tasks.v2.RateLimits build() { 411 com.google.cloud.tasks.v2.RateLimits result = buildPartial(); 412 if (!result.isInitialized()) { 413 throw newUninitializedMessageException(result); 414 } 415 return result; 416 } 417 418 @java.lang.Override buildPartial()419 public com.google.cloud.tasks.v2.RateLimits buildPartial() { 420 com.google.cloud.tasks.v2.RateLimits result = new com.google.cloud.tasks.v2.RateLimits(this); 421 if (bitField0_ != 0) { 422 buildPartial0(result); 423 } 424 onBuilt(); 425 return result; 426 } 427 buildPartial0(com.google.cloud.tasks.v2.RateLimits result)428 private void buildPartial0(com.google.cloud.tasks.v2.RateLimits result) { 429 int from_bitField0_ = bitField0_; 430 if (((from_bitField0_ & 0x00000001) != 0)) { 431 result.maxDispatchesPerSecond_ = maxDispatchesPerSecond_; 432 } 433 if (((from_bitField0_ & 0x00000002) != 0)) { 434 result.maxBurstSize_ = maxBurstSize_; 435 } 436 if (((from_bitField0_ & 0x00000004) != 0)) { 437 result.maxConcurrentDispatches_ = maxConcurrentDispatches_; 438 } 439 } 440 441 @java.lang.Override clone()442 public Builder clone() { 443 return super.clone(); 444 } 445 446 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)447 public Builder setField( 448 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 449 return super.setField(field, value); 450 } 451 452 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)453 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 454 return super.clearField(field); 455 } 456 457 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)458 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 459 return super.clearOneof(oneof); 460 } 461 462 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)463 public Builder setRepeatedField( 464 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 465 return super.setRepeatedField(field, index, value); 466 } 467 468 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)469 public Builder addRepeatedField( 470 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 471 return super.addRepeatedField(field, value); 472 } 473 474 @java.lang.Override mergeFrom(com.google.protobuf.Message other)475 public Builder mergeFrom(com.google.protobuf.Message other) { 476 if (other instanceof com.google.cloud.tasks.v2.RateLimits) { 477 return mergeFrom((com.google.cloud.tasks.v2.RateLimits) other); 478 } else { 479 super.mergeFrom(other); 480 return this; 481 } 482 } 483 mergeFrom(com.google.cloud.tasks.v2.RateLimits other)484 public Builder mergeFrom(com.google.cloud.tasks.v2.RateLimits other) { 485 if (other == com.google.cloud.tasks.v2.RateLimits.getDefaultInstance()) return this; 486 if (other.getMaxDispatchesPerSecond() != 0D) { 487 setMaxDispatchesPerSecond(other.getMaxDispatchesPerSecond()); 488 } 489 if (other.getMaxBurstSize() != 0) { 490 setMaxBurstSize(other.getMaxBurstSize()); 491 } 492 if (other.getMaxConcurrentDispatches() != 0) { 493 setMaxConcurrentDispatches(other.getMaxConcurrentDispatches()); 494 } 495 this.mergeUnknownFields(other.getUnknownFields()); 496 onChanged(); 497 return this; 498 } 499 500 @java.lang.Override isInitialized()501 public final boolean isInitialized() { 502 return true; 503 } 504 505 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)506 public Builder mergeFrom( 507 com.google.protobuf.CodedInputStream input, 508 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 509 throws java.io.IOException { 510 if (extensionRegistry == null) { 511 throw new java.lang.NullPointerException(); 512 } 513 try { 514 boolean done = false; 515 while (!done) { 516 int tag = input.readTag(); 517 switch (tag) { 518 case 0: 519 done = true; 520 break; 521 case 9: 522 { 523 maxDispatchesPerSecond_ = input.readDouble(); 524 bitField0_ |= 0x00000001; 525 break; 526 } // case 9 527 case 16: 528 { 529 maxBurstSize_ = input.readInt32(); 530 bitField0_ |= 0x00000002; 531 break; 532 } // case 16 533 case 24: 534 { 535 maxConcurrentDispatches_ = input.readInt32(); 536 bitField0_ |= 0x00000004; 537 break; 538 } // case 24 539 default: 540 { 541 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 542 done = true; // was an endgroup tag 543 } 544 break; 545 } // default: 546 } // switch (tag) 547 } // while (!done) 548 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 549 throw e.unwrapIOException(); 550 } finally { 551 onChanged(); 552 } // finally 553 return this; 554 } 555 556 private int bitField0_; 557 558 private double maxDispatchesPerSecond_; 559 /** 560 * 561 * 562 * <pre> 563 * The maximum rate at which tasks are dispatched from this queue. 564 * If unspecified when the queue is created, Cloud Tasks will pick the 565 * default. 566 * * The maximum allowed value is 500. 567 * This field has the same meaning as 568 * [rate in 569 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). 570 * </pre> 571 * 572 * <code>double max_dispatches_per_second = 1;</code> 573 * 574 * @return The maxDispatchesPerSecond. 575 */ 576 @java.lang.Override getMaxDispatchesPerSecond()577 public double getMaxDispatchesPerSecond() { 578 return maxDispatchesPerSecond_; 579 } 580 /** 581 * 582 * 583 * <pre> 584 * The maximum rate at which tasks are dispatched from this queue. 585 * If unspecified when the queue is created, Cloud Tasks will pick the 586 * default. 587 * * The maximum allowed value is 500. 588 * This field has the same meaning as 589 * [rate in 590 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). 591 * </pre> 592 * 593 * <code>double max_dispatches_per_second = 1;</code> 594 * 595 * @param value The maxDispatchesPerSecond to set. 596 * @return This builder for chaining. 597 */ setMaxDispatchesPerSecond(double value)598 public Builder setMaxDispatchesPerSecond(double value) { 599 600 maxDispatchesPerSecond_ = value; 601 bitField0_ |= 0x00000001; 602 onChanged(); 603 return this; 604 } 605 /** 606 * 607 * 608 * <pre> 609 * The maximum rate at which tasks are dispatched from this queue. 610 * If unspecified when the queue is created, Cloud Tasks will pick the 611 * default. 612 * * The maximum allowed value is 500. 613 * This field has the same meaning as 614 * [rate in 615 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). 616 * </pre> 617 * 618 * <code>double max_dispatches_per_second = 1;</code> 619 * 620 * @return This builder for chaining. 621 */ clearMaxDispatchesPerSecond()622 public Builder clearMaxDispatchesPerSecond() { 623 bitField0_ = (bitField0_ & ~0x00000001); 624 maxDispatchesPerSecond_ = 0D; 625 onChanged(); 626 return this; 627 } 628 629 private int maxBurstSize_; 630 /** 631 * 632 * 633 * <pre> 634 * Output only. The max burst size. 635 * Max burst size limits how fast tasks in queue are processed when 636 * many tasks are in the queue and the rate is high. This field 637 * allows the queue to have a high rate so processing starts shortly 638 * after a task is enqueued, but still limits resource usage when 639 * many tasks are enqueued in a short period of time. 640 * The [token bucket](https://wikipedia.org/wiki/Token_Bucket) 641 * algorithm is used to control the rate of task dispatches. Each 642 * queue has a token bucket that holds tokens, up to the maximum 643 * specified by `max_burst_size`. Each time a task is dispatched, a 644 * token is removed from the bucket. Tasks will be dispatched until 645 * the queue's bucket runs out of tokens. The bucket will be 646 * continuously refilled with new tokens based on 647 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 648 * Cloud Tasks will pick the value of `max_burst_size` based on the 649 * value of 650 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 651 * For queues that were created or updated using 652 * `queue.yaml/xml`, `max_burst_size` is equal to 653 * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). 654 * Since `max_burst_size` is output only, if 655 * [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a 656 * queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on 657 * the value of 658 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], 659 * regardless of whether 660 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] 661 * is updated. 662 * </pre> 663 * 664 * <code>int32 max_burst_size = 2;</code> 665 * 666 * @return The maxBurstSize. 667 */ 668 @java.lang.Override getMaxBurstSize()669 public int getMaxBurstSize() { 670 return maxBurstSize_; 671 } 672 /** 673 * 674 * 675 * <pre> 676 * Output only. The max burst size. 677 * Max burst size limits how fast tasks in queue are processed when 678 * many tasks are in the queue and the rate is high. This field 679 * allows the queue to have a high rate so processing starts shortly 680 * after a task is enqueued, but still limits resource usage when 681 * many tasks are enqueued in a short period of time. 682 * The [token bucket](https://wikipedia.org/wiki/Token_Bucket) 683 * algorithm is used to control the rate of task dispatches. Each 684 * queue has a token bucket that holds tokens, up to the maximum 685 * specified by `max_burst_size`. Each time a task is dispatched, a 686 * token is removed from the bucket. Tasks will be dispatched until 687 * the queue's bucket runs out of tokens. The bucket will be 688 * continuously refilled with new tokens based on 689 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 690 * Cloud Tasks will pick the value of `max_burst_size` based on the 691 * value of 692 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 693 * For queues that were created or updated using 694 * `queue.yaml/xml`, `max_burst_size` is equal to 695 * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). 696 * Since `max_burst_size` is output only, if 697 * [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a 698 * queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on 699 * the value of 700 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], 701 * regardless of whether 702 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] 703 * is updated. 704 * </pre> 705 * 706 * <code>int32 max_burst_size = 2;</code> 707 * 708 * @param value The maxBurstSize to set. 709 * @return This builder for chaining. 710 */ setMaxBurstSize(int value)711 public Builder setMaxBurstSize(int value) { 712 713 maxBurstSize_ = value; 714 bitField0_ |= 0x00000002; 715 onChanged(); 716 return this; 717 } 718 /** 719 * 720 * 721 * <pre> 722 * Output only. The max burst size. 723 * Max burst size limits how fast tasks in queue are processed when 724 * many tasks are in the queue and the rate is high. This field 725 * allows the queue to have a high rate so processing starts shortly 726 * after a task is enqueued, but still limits resource usage when 727 * many tasks are enqueued in a short period of time. 728 * The [token bucket](https://wikipedia.org/wiki/Token_Bucket) 729 * algorithm is used to control the rate of task dispatches. Each 730 * queue has a token bucket that holds tokens, up to the maximum 731 * specified by `max_burst_size`. Each time a task is dispatched, a 732 * token is removed from the bucket. Tasks will be dispatched until 733 * the queue's bucket runs out of tokens. The bucket will be 734 * continuously refilled with new tokens based on 735 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 736 * Cloud Tasks will pick the value of `max_burst_size` based on the 737 * value of 738 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. 739 * For queues that were created or updated using 740 * `queue.yaml/xml`, `max_burst_size` is equal to 741 * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). 742 * Since `max_burst_size` is output only, if 743 * [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a 744 * queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on 745 * the value of 746 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], 747 * regardless of whether 748 * [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] 749 * is updated. 750 * </pre> 751 * 752 * <code>int32 max_burst_size = 2;</code> 753 * 754 * @return This builder for chaining. 755 */ clearMaxBurstSize()756 public Builder clearMaxBurstSize() { 757 bitField0_ = (bitField0_ & ~0x00000002); 758 maxBurstSize_ = 0; 759 onChanged(); 760 return this; 761 } 762 763 private int maxConcurrentDispatches_; 764 /** 765 * 766 * 767 * <pre> 768 * The maximum number of concurrent tasks that Cloud Tasks allows 769 * to be dispatched for this queue. After this threshold has been 770 * reached, Cloud Tasks stops dispatching tasks until the number of 771 * concurrent requests decreases. 772 * If unspecified when the queue is created, Cloud Tasks will pick the 773 * default. 774 * The maximum allowed value is 5,000. 775 * This field has the same meaning as 776 * [max_concurrent_requests in 777 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). 778 * </pre> 779 * 780 * <code>int32 max_concurrent_dispatches = 3;</code> 781 * 782 * @return The maxConcurrentDispatches. 783 */ 784 @java.lang.Override getMaxConcurrentDispatches()785 public int getMaxConcurrentDispatches() { 786 return maxConcurrentDispatches_; 787 } 788 /** 789 * 790 * 791 * <pre> 792 * The maximum number of concurrent tasks that Cloud Tasks allows 793 * to be dispatched for this queue. After this threshold has been 794 * reached, Cloud Tasks stops dispatching tasks until the number of 795 * concurrent requests decreases. 796 * If unspecified when the queue is created, Cloud Tasks will pick the 797 * default. 798 * The maximum allowed value is 5,000. 799 * This field has the same meaning as 800 * [max_concurrent_requests in 801 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). 802 * </pre> 803 * 804 * <code>int32 max_concurrent_dispatches = 3;</code> 805 * 806 * @param value The maxConcurrentDispatches to set. 807 * @return This builder for chaining. 808 */ setMaxConcurrentDispatches(int value)809 public Builder setMaxConcurrentDispatches(int value) { 810 811 maxConcurrentDispatches_ = value; 812 bitField0_ |= 0x00000004; 813 onChanged(); 814 return this; 815 } 816 /** 817 * 818 * 819 * <pre> 820 * The maximum number of concurrent tasks that Cloud Tasks allows 821 * to be dispatched for this queue. After this threshold has been 822 * reached, Cloud Tasks stops dispatching tasks until the number of 823 * concurrent requests decreases. 824 * If unspecified when the queue is created, Cloud Tasks will pick the 825 * default. 826 * The maximum allowed value is 5,000. 827 * This field has the same meaning as 828 * [max_concurrent_requests in 829 * queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). 830 * </pre> 831 * 832 * <code>int32 max_concurrent_dispatches = 3;</code> 833 * 834 * @return This builder for chaining. 835 */ clearMaxConcurrentDispatches()836 public Builder clearMaxConcurrentDispatches() { 837 bitField0_ = (bitField0_ & ~0x00000004); 838 maxConcurrentDispatches_ = 0; 839 onChanged(); 840 return this; 841 } 842 843 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)844 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 845 return super.setUnknownFields(unknownFields); 846 } 847 848 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)849 public final Builder mergeUnknownFields( 850 final com.google.protobuf.UnknownFieldSet unknownFields) { 851 return super.mergeUnknownFields(unknownFields); 852 } 853 854 // @@protoc_insertion_point(builder_scope:google.cloud.tasks.v2.RateLimits) 855 } 856 857 // @@protoc_insertion_point(class_scope:google.cloud.tasks.v2.RateLimits) 858 private static final com.google.cloud.tasks.v2.RateLimits DEFAULT_INSTANCE; 859 860 static { 861 DEFAULT_INSTANCE = new com.google.cloud.tasks.v2.RateLimits(); 862 } 863 getDefaultInstance()864 public static com.google.cloud.tasks.v2.RateLimits getDefaultInstance() { 865 return DEFAULT_INSTANCE; 866 } 867 868 private static final com.google.protobuf.Parser<RateLimits> PARSER = 869 new com.google.protobuf.AbstractParser<RateLimits>() { 870 @java.lang.Override 871 public RateLimits parsePartialFrom( 872 com.google.protobuf.CodedInputStream input, 873 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 874 throws com.google.protobuf.InvalidProtocolBufferException { 875 Builder builder = newBuilder(); 876 try { 877 builder.mergeFrom(input, extensionRegistry); 878 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 879 throw e.setUnfinishedMessage(builder.buildPartial()); 880 } catch (com.google.protobuf.UninitializedMessageException e) { 881 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 882 } catch (java.io.IOException e) { 883 throw new com.google.protobuf.InvalidProtocolBufferException(e) 884 .setUnfinishedMessage(builder.buildPartial()); 885 } 886 return builder.buildPartial(); 887 } 888 }; 889 parser()890 public static com.google.protobuf.Parser<RateLimits> parser() { 891 return PARSER; 892 } 893 894 @java.lang.Override getParserForType()895 public com.google.protobuf.Parser<RateLimits> getParserForType() { 896 return PARSER; 897 } 898 899 @java.lang.Override getDefaultInstanceForType()900 public com.google.cloud.tasks.v2.RateLimits getDefaultInstanceForType() { 901 return DEFAULT_INSTANCE; 902 } 903 } 904