Esempio n. 1
0
 private static CircuitRegistry CreateRegistry(CircuitIdFactory factory = null)
 {
     return(new CircuitRegistry(
                Options.Create(new CircuitOptions()),
                NullLogger <CircuitRegistry> .Instance,
                factory ?? TestCircuitIdFactory.CreateTestFactory()));
 }
 public DefaultCircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory)
 {
     _scopeFactory     = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _loggerFactory    = loggerFactory;
     _circuitIdFactory = circuitIdFactory ?? throw new ArgumentNullException(nameof(circuitIdFactory));
 }
Esempio n. 3
0
 public CircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory,
     IOptions <CircuitOptions> options)
 {
     _scopeFactory     = scopeFactory;
     _loggerFactory    = loggerFactory;
     _circuitIdFactory = circuitIdFactory;
     _options          = options.Value;
     _logger           = _loggerFactory.CreateLogger <CircuitFactory>();
 }
 public DefaultCircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory,
     IOptions <CircuitOptions> options)
 {
     _scopeFactory     = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _loggerFactory    = loggerFactory;
     _logger           = _loggerFactory.CreateLogger <CircuitFactory>();
     _circuitIdFactory = circuitIdFactory ?? throw new ArgumentNullException(nameof(circuitIdFactory));
     _options          = options.Value;
 }
Esempio n. 5
0
        public CircuitRegistry(
            IOptions <CircuitOptions> options,
            ILogger <CircuitRegistry> logger,
            CircuitIdFactory circuitIdFactory)
        {
            _options          = options.Value;
            _logger           = logger;
            _circuitIdFactory = circuitIdFactory;
            ConnectedCircuits = new ConcurrentDictionary <string, CircuitHost>(StringComparer.Ordinal);

            DisconnectedCircuits = new MemoryCache(new MemoryCacheOptions
            {
                SizeLimit = _options.DisconnectedCircuitMaxRetained,
            });

            _postEvictionCallback = new PostEvictionCallbackRegistration
            {
                EvictionCallback = OnEntryEvicted,
            };
        }
Esempio n. 6
0
 public TestCircuitRegistry(CircuitIdFactory factory)
     : base(Options.Create(new CircuitOptions()), NullLogger <CircuitRegistry> .Instance, factory)
 {
 }