ReadRequest.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_topic.proto
  4. namespace Ydb\Topic\StreamReadMessage;
  5. use Google\Protobuf\Internal\GPBType;
  6. use Google\Protobuf\Internal\RepeatedField;
  7. use Google\Protobuf\Internal\GPBUtil;
  8. /**
  9. * Message that represents client readiness for receiving more data.
  10. *
  11. * Generated from protobuf message <code>Ydb.Topic.StreamReadMessage.ReadRequest</code>
  12. */
  13. class ReadRequest extends \Google\Protobuf\Internal\Message
  14. {
  15. /**
  16. * Server and client each keep track of total bytes size of all ReadResponses.
  17. * When client is ready to receive N more bytes in responses (to increment possible total by N),
  18. * it sends a ReadRequest with bytes_size = N.
  19. * bytes_size value must be positive.
  20. * So in expression 'A = (sum of bytes_size in all ReadRequests) - (sum of bytes_size in all ReadResponses)'
  21. * server will keep A (available size for responses) non-negative.
  22. * But there is an exception. If server receives ReadRequest, and the first message in response exceeds A -
  23. * then it will still be delivered, and A will become negative until enough additional ReadRequests.
  24. * Example:
  25. * 1) Let client have 200 bytes buffer. It sends ReadRequest with bytes_size = 200;
  26. * 2) Server may return one ReadResponse with bytes_size = 70 and than another 80 bytes response;
  27. * now client buffer has 50 free bytes, server is free to send up to 50 bytes in responses.
  28. * 3) Client processes 100 bytes from buffer, now buffer free space is 150 bytes,
  29. * so client sends ReadRequest with bytes_size = 100;
  30. * 4) Server is free to send up to 50 + 100 = 150 bytes. But the next read message is too big,
  31. * and it sends 160 bytes ReadResponse.
  32. * 5) Let's assume client somehow processes it, and its 200 bytes buffer is free again.
  33. * It shoud account for excess 10 bytes and send ReadRequest with bytes_size = 210.
  34. *
  35. * Generated from protobuf field <code>int64 bytes_size = 1;</code>
  36. */
  37. protected $bytes_size = 0;
  38. /**
  39. * Constructor.
  40. *
  41. * @param array $data {
  42. * Optional. Data for populating the Message object.
  43. *
  44. * @type int|string $bytes_size
  45. * Server and client each keep track of total bytes size of all ReadResponses.
  46. * When client is ready to receive N more bytes in responses (to increment possible total by N),
  47. * it sends a ReadRequest with bytes_size = N.
  48. * bytes_size value must be positive.
  49. * So in expression 'A = (sum of bytes_size in all ReadRequests) - (sum of bytes_size in all ReadResponses)'
  50. * server will keep A (available size for responses) non-negative.
  51. * But there is an exception. If server receives ReadRequest, and the first message in response exceeds A -
  52. * then it will still be delivered, and A will become negative until enough additional ReadRequests.
  53. * Example:
  54. * 1) Let client have 200 bytes buffer. It sends ReadRequest with bytes_size = 200;
  55. * 2) Server may return one ReadResponse with bytes_size = 70 and than another 80 bytes response;
  56. * now client buffer has 50 free bytes, server is free to send up to 50 bytes in responses.
  57. * 3) Client processes 100 bytes from buffer, now buffer free space is 150 bytes,
  58. * so client sends ReadRequest with bytes_size = 100;
  59. * 4) Server is free to send up to 50 + 100 = 150 bytes. But the next read message is too big,
  60. * and it sends 160 bytes ReadResponse.
  61. * 5) Let's assume client somehow processes it, and its 200 bytes buffer is free again.
  62. * It shoud account for excess 10 bytes and send ReadRequest with bytes_size = 210.
  63. * }
  64. */
  65. public function __construct($data = NULL) {
  66. \GPBMetadata\Protos\YdbTopic::initOnce();
  67. parent::__construct($data);
  68. }
  69. /**
  70. * Server and client each keep track of total bytes size of all ReadResponses.
  71. * When client is ready to receive N more bytes in responses (to increment possible total by N),
  72. * it sends a ReadRequest with bytes_size = N.
  73. * bytes_size value must be positive.
  74. * So in expression 'A = (sum of bytes_size in all ReadRequests) - (sum of bytes_size in all ReadResponses)'
  75. * server will keep A (available size for responses) non-negative.
  76. * But there is an exception. If server receives ReadRequest, and the first message in response exceeds A -
  77. * then it will still be delivered, and A will become negative until enough additional ReadRequests.
  78. * Example:
  79. * 1) Let client have 200 bytes buffer. It sends ReadRequest with bytes_size = 200;
  80. * 2) Server may return one ReadResponse with bytes_size = 70 and than another 80 bytes response;
  81. * now client buffer has 50 free bytes, server is free to send up to 50 bytes in responses.
  82. * 3) Client processes 100 bytes from buffer, now buffer free space is 150 bytes,
  83. * so client sends ReadRequest with bytes_size = 100;
  84. * 4) Server is free to send up to 50 + 100 = 150 bytes. But the next read message is too big,
  85. * and it sends 160 bytes ReadResponse.
  86. * 5) Let's assume client somehow processes it, and its 200 bytes buffer is free again.
  87. * It shoud account for excess 10 bytes and send ReadRequest with bytes_size = 210.
  88. *
  89. * Generated from protobuf field <code>int64 bytes_size = 1;</code>
  90. * @return int|string
  91. */
  92. public function getBytesSize()
  93. {
  94. return $this->bytes_size;
  95. }
  96. /**
  97. * Server and client each keep track of total bytes size of all ReadResponses.
  98. * When client is ready to receive N more bytes in responses (to increment possible total by N),
  99. * it sends a ReadRequest with bytes_size = N.
  100. * bytes_size value must be positive.
  101. * So in expression 'A = (sum of bytes_size in all ReadRequests) - (sum of bytes_size in all ReadResponses)'
  102. * server will keep A (available size for responses) non-negative.
  103. * But there is an exception. If server receives ReadRequest, and the first message in response exceeds A -
  104. * then it will still be delivered, and A will become negative until enough additional ReadRequests.
  105. * Example:
  106. * 1) Let client have 200 bytes buffer. It sends ReadRequest with bytes_size = 200;
  107. * 2) Server may return one ReadResponse with bytes_size = 70 and than another 80 bytes response;
  108. * now client buffer has 50 free bytes, server is free to send up to 50 bytes in responses.
  109. * 3) Client processes 100 bytes from buffer, now buffer free space is 150 bytes,
  110. * so client sends ReadRequest with bytes_size = 100;
  111. * 4) Server is free to send up to 50 + 100 = 150 bytes. But the next read message is too big,
  112. * and it sends 160 bytes ReadResponse.
  113. * 5) Let's assume client somehow processes it, and its 200 bytes buffer is free again.
  114. * It shoud account for excess 10 bytes and send ReadRequest with bytes_size = 210.
  115. *
  116. * Generated from protobuf field <code>int64 bytes_size = 1;</code>
  117. * @param int|string $var
  118. * @return $this
  119. */
  120. public function setBytesSize($var)
  121. {
  122. GPBUtil::checkInt64($var);
  123. $this->bytes_size = $var;
  124. return $this;
  125. }
  126. }
  127. // Adding a class alias for backwards compatibility with the previous class name.
  128. class_alias(ReadRequest::class, \Ydb\Topic\StreamReadMessage_ReadRequest::class);