Esempio n. 1
0
        /// <inheritdoc />
        public void Log(LogEvent @event)
        {
            if (@event == null)
            {
                return;
            }

            if (!IsEnabledFor(@event.Level))
            {
                return;
            }

            while (true)
            {
                var settings     = settingsProvider.Get();
                var file         = filePathProvider.Get(settings);
                var registration = ObtainMuxerRegistration(file, settings);

                if (!muxer.TryAdd(file, new LogEventInfo(@event, settings), muxerHandleRef))
                {
                    eventsLost.Increment();
                    break;
                }

                if (registration.IsValid(file))
                {
                    break;
                }
            }
        }
        public void Modify(Uri replica, IList <Uri> allReplicas, IReplicaStorageProvider storageProvider, Request request, RequestParameters parameters, ref double weight)
        {
            var weights = transform.Get(serviceLocator.Locate(environment, application));

            if (weights == null || !weights.TryGetValue(replica, out var snitchWeight))
            {
                return;
            }

            weight *= snitchWeight.Value;
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new instance of <see cref="ZooKeeperClientSettings"/> using given <paramref name="replicasProvider"/>.
        /// </summary>
        public ZooKeeperClientSettings([NotNull] Func <IList <Uri> > replicasProvider)
        {
            if (replicasProvider == null)
            {
                throw new ArgumentNullException(nameof(replicasProvider));
            }

            var transform = new CachingTransform <IList <Uri>, string>(BuildConnectionString);

            ConnectionStringProvider = () => transform.Get(replicasProvider());
        }
Esempio n. 4
0
 public List <IdempotencyControlRule> Get()
 {
     return(cache.Get());
 }
 public List <NonIdempotencySign> Get()
 {
     return(cache.Get());
 }
 public void Get_without_parameters_should_work_when_there_is_no_cache()
 {
     transform.Get().Should().Be("XXX");
 }
 public IList <Uri> GetCluster()
 => cache.Get();
Esempio n. 8
0
 public static IPAddress[] Get() => LocalNetworksTransform.Get(NetworkHelper.LocalNetworks);
Esempio n. 9
0
 public IList <Uri> GetCluster()
 => transform.Get(serviceLocator.Locate(environment, application));