コード例 #1
0
 public ClientDefaultInterceptor(ILoadBalancing loadBalancing, IClientFactory clientFactory, ICircuitBreaker circuitBreaker, UraganoSettings uraganoSettings)
 {
     LoadBalancing   = loadBalancing;
     ClientFactory   = clientFactory;
     CircuitBreaker  = circuitBreaker;
     UraganoSettings = uraganoSettings;
 }
コード例 #2
0
        public RedisPartitionCaching(UraganoSettings uraganoSettings, IServiceProvider serviceProvider, ICodec codec, IConsistentHash <RedisConnection> consistentHash)
        {
            Codec = codec;
            var redisOptions = (RedisOptions)uraganoSettings.CachingOptions;

            ConsistentHash = consistentHash;
            var policy = serviceProvider.GetService <Func <string, IEnumerable <RedisConnection>, RedisConnection> >();

            if (policy == null)
            {
                foreach (var item in redisOptions.ConnectionStrings)
                {
                    ConsistentHash.AddNode(item, item.ToString());
                }
                policy = (key, connections) => ConsistentHash.GetNodeForKey(key);
            }

            string NodeRule(string key)
            {
                var connection = policy(key, redisOptions.ConnectionStrings);

                return($"{connection.Host}:{connection.Port}/{connection.DefaultDatabase}");
            }

            RedisHelper.Initialization(new CSRedis.CSRedisClient(NodeRule, redisOptions.ConnectionStrings.Select(p => p.ToString()).ToArray()));
            Cache = new Microsoft.Extensions.Caching.Redis.CSRedisCache(RedisHelper.Instance);
        }
コード例 #3
0
 public RemotingInvoke(ILoadBalancing loadBalancing, IClientFactory clientFactory, IServiceFactory serviceFactory, UraganoSettings uraganoSettings, IServiceProvider serviceProvider)
 {
     LoadBalancing   = loadBalancing;
     ClientFactory   = clientFactory;
     ServiceFactory  = serviceFactory;
     UraganoSettings = uraganoSettings;
     ServiceProvider = serviceProvider;
 }
コード例 #4
0
ファイル: ConsulTest.cs プロジェクト: ywscr/Uragano
 public ConsulFixture()
 {
     UraganoSettings = new UraganoSettings
     {
         //ServiceDiscoveryClientConfiguration = new ConsulClientConfigure
         //{
         //    Address = new Uri("http://192.168.1.254:8500"),
         //    Token = "5ece74af-19d1-0e61-b25c-b9665d29f50b"
         //},
         ServerSettings = new ServerSettings
         {
             Address = "127.0.0.1",
             Port    = 1000
         }
     };
 }
コード例 #5
0
        public ConsulServiceDiscovery(UraganoSettings uraganoSettings, ILogger <ConsulServiceDiscovery> logger, IServiceDiscoveryClientConfiguration clientConfiguration, IServiceProvider service)
        {
            if (!(clientConfiguration is ConsulClientConfigure client))
            {
                throw new ArgumentNullException(nameof(clientConfiguration));
            }
            var agent = service.GetService <IServiceRegisterConfiguration>();

            if (agent != null)
            {
                if (!(agent is ConsulRegisterServiceConfiguration serviceAgent))
                {
                    throw new ArgumentNullException(nameof(ConsulRegisterServiceConfiguration));
                }
                ConsulRegisterServiceConfiguration = serviceAgent;
            }


            ConsulClientConfigure = client;
            ServerSettings        = uraganoSettings.ServerSettings;
            Logger = logger;
        }
コード例 #6
0
        public RedisPartitionCaching(UraganoSettings uraganoSettings, IServiceProvider serviceProvider)
        {
            var redisOptions = (RedisOptions)uraganoSettings.CachingOptions;
            var policy       = serviceProvider.GetService <IRedisPartitionPolicy>();

            if (policy != null)
            {
                string NodeRule(string key)
                {
                    var connection = policy.Policy(key, redisOptions.ConnectionStrings);

                    return($"{connection.Host}:{connection.Port}/{connection.DefaultDatabase}");
                }

                RedisHelper.Initialization(new CSRedis.CSRedisClient(NodeRule,
                                                                     redisOptions.ConnectionStrings.Select(p => p.ToString()).ToArray()));
            }
            else
            {
                RedisHelper.Initialization(new CSRedis.CSRedisClient(NodeRule: null, redisOptions.ConnectionStrings.Select(p => p.ToString()).ToArray()));
            }

            Cache = new Microsoft.Extensions.Caching.Redis.CSRedisCache(RedisHelper.Instance);
        }
コード例 #7
0
 public InitializationPartitionRedis(IRedisPartitionPolicy redisPartitionPolicy, UraganoSettings uraganoSettings, IServiceCollection serviceCollection)
 {
     RedisOptions         = (RedisOptions)uraganoSettings.CachingOptions;
     RedisPartitionPolicy = redisPartitionPolicy;
     ServiceCollection    = serviceCollection;
 }
コード例 #8
0
 public DotNettyBootstrapStartup(UraganoSettings uraganoSettings, IBootstrap bootstrap)
 {
     UraganoSettings = uraganoSettings;
     Bootstrap       = bootstrap;
 }
コード例 #9
0
ファイル: ServerBootstrap.cs プロジェクト: ywscr/Uragano
 public ServerBootstrap(IServiceFactory serviceFactory, IServiceProvider serviceProvider, UraganoSettings uraganoSettings, ILogger <ServerBootstrap> logger, ICodec codec)
 {
     ServiceFactory  = serviceFactory;
     ServiceProvider = serviceProvider;
     ServerSettings  = uraganoSettings.ServerSettings;
     Logger          = logger;
     Codec           = codec;
 }
コード例 #10
0
 public ServiceDiscoveryStartup(IServiceDiscovery serviceDiscovery, UraganoSettings uraganoSettings)
 {
     ServiceDiscovery = serviceDiscovery;
     ServerSettings   = uraganoSettings.ServerSettings;
 }
コード例 #11
0
 public CachingDefaultInterceptor(ICaching caching, ICachingKeyGenerator keyGenerator, UraganoSettings uraganoSettings, IServiceFactory serviceFactory)
 {
     Caching        = caching;
     KeyGenerator   = keyGenerator;
     CachingOptions = uraganoSettings.CachingOptions;
     ServiceFactory = serviceFactory;
 }
コード例 #12
0
        public ZooKeeperServiceDiscovery(ICodec codec, ILogger <ZooKeeperServiceDiscovery> logger, UraganoSettings uraganoSettings, IServiceDiscoveryClientConfiguration clientConfiguration, IServiceProvider service)
        {
            if (!(clientConfiguration is ZooKeeperClientConfigure client))
            {
                throw new ArgumentNullException(nameof(clientConfiguration));
            }
            ZooKeeperClientConfigure = client;

            var agent = service.GetService <IServiceRegisterConfiguration>();

            if (agent != null)
            {
                if (!(agent is ZooKeeperRegisterServiceConfiguration serviceAgent))
                {
                    throw new ArgumentNullException(nameof(ZooKeeperRegisterServiceConfiguration));
                }
                ZooKeeperRegisterServiceConfiguration = serviceAgent;
            }
            ZooKeeperWatcher           = new UraganoWatcher();
            ZooKeeperWatcher.OnChange += Watcher_OnChange;;
            ServerSettings             = uraganoSettings.ServerSettings;
            Codec  = codec;
            Logger = logger;
            CreateZooKeeperClient();
        }
コード例 #13
0
ファイル: RemotingInvoke.cs プロジェクト: ywscr/Uragano
 public RemotingInvoke(IServiceFactory serviceFactory, UraganoSettings uraganoSettings, IServiceProvider serviceProvider)
 {
     ServiceFactory  = serviceFactory;
     UraganoSettings = uraganoSettings;
     ServiceProvider = serviceProvider;
 }
コード例 #14
0
 public ServiceStatusManageFactory(ILogger <ServiceStatusManageFactory> logger, IServiceDiscovery serviceDiscovery, UraganoSettings uraganoSettings)
 {
     Logger           = logger;
     ServiceDiscovery = serviceDiscovery;
     UraganoSettings  = uraganoSettings;
 }
コード例 #15
0
 public ServiceStatusManageStartup(IServiceStatusManageFactory serviceStatusManageFactory, UraganoSettings uraganoSettings, ILogger <ServiceStatusManageStartup> logger)
 {
     ServiceStatusManageFactory = serviceStatusManageFactory;
     UraganoSettings            = uraganoSettings;
     Logger = logger;
 }
コード例 #16
0
 public ConsulServiceDiscovery(UraganoSettings uraganoSettings, ILogger <ConsulServiceDiscovery> logger)
 {
     UraganoSettings = uraganoSettings;
     Logger          = logger;
 }
コード例 #17
0
 public RedisCaching(ICodec codec, UraganoSettings uraganoSettings)
 {
     Codec = codec;
     RedisHelper.Initialization(new CSRedis.CSRedisClient(((RedisOptions)uraganoSettings.CachingOptions).ConnectionStrings.First().ToString()));
 }
コード例 #18
0
 public ServiceBuilder(IServiceFactory serviceFactory, IServiceProvider serviceProvider, UraganoSettings uraganoSettings)
 {
     ServiceFactory  = serviceFactory;
     ServiceProvider = serviceProvider;
     UraganoSettings = uraganoSettings;
 }
コード例 #19
0
 public ServiceFactory(IServiceProvider serviceProvider, UraganoSettings uraganoSettings, IScriptInjection scriptInjection)
 {
     ServiceProvider = serviceProvider;
     UraganoSettings = uraganoSettings;
     ScriptInjection = scriptInjection;
 }
コード例 #20
0
 public InfrastructureStartup(UraganoSettings uraganoSettings, ILoggerFactory loggerFactory)
 {
     UraganoSettings = uraganoSettings;
     LoggerFactory   = loggerFactory;
 }
コード例 #21
0
 public InitializationRedis(UraganoSettings uraganoSettings)
 {
     RedisOptions = (RedisOptions)uraganoSettings.CachingOptions;
 }