public SplitWeightManipulationStrategy(
     IWeightManipulationStrategy increment,
     IWeightManipulationStrategy decrement)
 {
     Increment = increment;
     Decrement = decrement;
 }
Esempio n. 2
0
 public GrpcChannelManager(
     IReadOnlyDictionary <string, WeightItem> resources,
     IWeightManipulationStrategy weightStrategy,
     TimeSpan timeout,
     int maxRetry) : this(resources, weightStrategy, timeout, GetRetryCountPredicate(maxRetry))
 {
 }
        public ResourceManager(
            IReadOnlyDictionary <TSource, WeightItem> collection,
            IWeightManipulationStrategy weightManipulationStrategy)
        {
            CheckCollectionArg(collection);

            _collection = collection.ToImmutableDictionary();
            _weightManipulationStrategy = weightManipulationStrategy;
        }
Esempio n. 4
0
        public GrpcChannelManager(
            IReadOnlyDictionary <string, WeightItem> resources,
            IWeightManipulationStrategy weightStrategy,
            TimeSpan timeout,
            ShouldRetryPredicate shouldRetry)
        {
            _shouldRetry = shouldRetry ?? throw new ArgumentNullException(nameof(shouldRetry));
            _timeout     = timeout;

            var resourceDict = CreateResourceDictionary(resources);

            ResourceManager = new ResourceManager <GrpcResource>(resourceDict, weightStrategy);
        }