コード例 #1
0
ファイル: SwarmCluster.cs プロジェクト: 5l1v3r1/Swarm-2
 public SwarmCluster(IOptions <SwarmOptions> options, ISharding sharding, IClientStore clientStore,
                     ILoggerFactory loggerFactory)
 {
     _options     = options.Value;
     _sharding    = sharding;
     _clientStore = clientStore;
     _logger      = loggerFactory.CreateLogger <SwarmCluster>();
 }
コード例 #2
0
ファイル: Hydra.Base.cs プロジェクト: Amazebytes/Hydra
        public static IHydra Create(ISharding sharding, params CloudStorageAccount[] accounts)
        {
            var hydra = new Hydra().SetSharding(sharding);

            foreach (var account in accounts)
            {
                hydra.AddAccount(account);
            }

            return hydra;
        }
コード例 #3
0
        public static IHydra Create(ISharding sharding, params CloudStorageAccount[] accounts)
        {
            var hydra = new Hydra().SetSharding(sharding);

            foreach (var account in accounts)
            {
                hydra.AddAccount(account);
            }

            return(hydra);
        }
コード例 #4
0
 public JobService(ISharding sharding, ISchedCache schedulerCache, ILoggerFactory loggerFactory,
                   ISwarmStore store,
                   IHubContext <ClientHub> hubContext,
                   IOptions <SwarmOptions> options)
 {
     _sharding   = sharding;
     _logger     = loggerFactory.CreateLogger <JobService>();
     _store      = store;
     _hubContext = hubContext;
     _schedCache = schedulerCache;
     _options    = options.Value;
 }
コード例 #5
0
        public static void DataBaseSharding(this IDataBaseSharding dataBaseSharding, int id = MatchedID.All, string tableIndex = null)
        {
            if (dataBaseSharding == null)
            {
                return;
            }
            var shardingValues            = dataBaseSharding.GetShardingColumnValues();
            var fatabaseShardingAttribute = dataBaseSharding.GetDataBaseShardingAttribute(id);

            if (fatabaseShardingAttribute == null)
            {
                return;
            }
            var       algorithm     = fatabaseShardingAttribute.ShardingAlgorithm;
            var       shardingTotal = fatabaseShardingAttribute.ShardingMaxCount;
            ISharding sharding      = Activator.CreateInstance(Type.GetType(algorithm)) as ISharding;

            dataBaseSharding.__DataBaseIndex__ = sharding.SharingByObject(shardingValues, shardingTotal);
        }
コード例 #6
0
        private string GetAuthenticationConnectionString(ISharding sharding)
        {
            var configuration = sharding.Configuration;

            var builder = new SqlConnectionStringBuilder()
            {
                IntegratedSecurity  = configuration.IntegrationSecurity,
                PersistSecurityInfo = true,
                ConnectTimeout      = configuration.ConnectTimeout,
                Pooling             = configuration.Pooling,
                MaxPoolSize         = configuration.MaxPoolSize,
                ApplicationName     = configuration.ApplicationName
            };

            if (!configuration.IntegrationSecurity)
            {
                builder.UserID   = configuration.Username;
                builder.Password = configuration.Password;
            }

            return(builder.ConnectionString);
        }
コード例 #7
0
        public static void TableSharding(this ITableSharding tableSharding, int id = MatchedID.All, string tableIndex = null)
        {
            if (tableSharding == null)
            {
                return;
            }
            var shardingValues         = tableSharding.GetShardingColumnValues();
            var tableShardingAttribute = tableSharding.GetTableShardingAttribute(id);

            if (tableShardingAttribute == null)
            {
                return;
            }
            var       algorithm          = tableShardingAttribute.ShardingAlgorithm;
            var       shardingTotal      = tableShardingAttribute.ShardingTotalCount;
            ISharding sharding           = Activator.CreateInstance(Type.GetType(algorithm)) as ISharding;
            var       tableIndexSharding = sharding.SharingByObject(shardingValues, shardingTotal);

            if (!string.IsNullOrEmpty(tableIndexSharding))
            {
                tableSharding.__TableIndex__ = tableIndexSharding;
            }
        }
コード例 #8
0
ファイル: Hydra.Base.cs プロジェクト: Amazebytes/Hydra
 public IHydra SetSharding(ISharding sharding)
 {
     _sharding = sharding;
     return this;
 }
コード例 #9
0
ファイル: Hydra.Base.cs プロジェクト: Amazebytes/Hydra
 public static IHydra Create(ISharding sharding)
 {
     return new Hydra().SetSharding(sharding);
 }
コード例 #10
0
 public IHydra SetSharding(ISharding sharding)
 {
     _sharding = sharding;
     return(this);
 }
コード例 #11
0
 public static IHydra Create(ISharding sharding)
 {
     return(new Hydra().SetSharding(sharding));
 }