Граф коммитов

11 Коммитов

Автор SHA1 Сообщение Дата
Menghan Li 24f3cca1ff
internal: move backoff to internal (#2141)
So other components such as grpclb can reuse the backoff implementation.
2018-06-13 16:07:37 -07:00
dfawley bd7f82c7b1
internal/grpcrand: New package for concurrency-safe randoms (#2106) 2018-05-29 09:06:35 -07:00
田欧 faebfcb7bf Remove single-entry var blocks (#1589) 2017-10-18 09:59:23 -07:00
田欧 a94a7ac054 add license for some files (#1296) 2017-06-12 18:10:06 -07:00
Keiji Yoshida 7f3c1cacae Removed the unused named return parameter of `BackoffConfig`'s `backoff` method. 2016-10-11 03:42:29 +09:00
Dmitri Shuralyov e8316072cd Fix remaining instances of gRPC spelling.
According to http://www.grpc.io/faq/, the project is called gRPC. It's
already referred by that name in most places, except a few instances
where it's still "GRPC". Fix those to have consistency.
2016-06-02 18:00:07 -07:00
iamqizhao 9cec19a4d4 make setDefault(...) non-member function 2016-04-18 13:15:27 -07:00
iamqizhao 75407c0f82 change backoff to pointer receiver 2016-04-18 12:12:19 -07:00
Stephen J Day 8ef1dcabab backoff: make DefaultBackoffConfig a concrete value
To enforce immutability of the `DefaultBackoffConfig`, we've made it a
concrete value. While fields can still be set directly on the value,
taking a copy will not incidentally pull a reference to the variable.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-04-18 11:33:39 -07:00
Stephen J Day 9ff38e9093 backoff: set default values on BackoffConfig
Because most of the fields on `BackoffConfig` are unexported, correctly
using the config requires copying from the default. This sets the
defaults appropriately and falls back to a default if MaxDelay is
negative or zero.

Tests are added to ensure that the backoff is set correctly in common
use cases.

Signedroff-by: Stephen J Day <stephen.day@docker.com>
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-04-15 16:12:47 -07:00
Stephen J Day 47b74a63a8 backoff: allow configuration of backoff strategy
The backoff function and parameters have been pulled up into an
interface `backoffStrategy`. The default parameters are now part of a
package variable `DefaultBackoffConfig`. The strategy is then plumbed
through `dialOptions`. As a result of this PR, the
maximum backoff delay can now be set using the `WithBackoffConfig` dial
option.

While the addition of strategy may seem premature, this allows one to
simply export `BackoffStrategy` and `WithBackoff` to allow arbirarily
configurable backoff strategies.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-04-07 20:17:57 -07:00