Ejemplo n.º 1
0
 public SwarmCluster(IOptions <SwarmOptions> options, ISharding sharding, IClientStore clientStore,
                     ILoggerFactory loggerFactory)
 {
     _options     = options.Value;
     _sharding    = sharding;
     _clientStore = clientStore;
     _logger      = loggerFactory.CreateLogger <SwarmCluster>();
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 8
0
 public IHydra SetSharding(ISharding sharding)
 {
     _sharding = sharding;
     return this;
 }
Ejemplo n.º 9
0
 public static IHydra Create(ISharding sharding)
 {
     return new Hydra().SetSharding(sharding);
 }
Ejemplo n.º 10
0
 public IHydra SetSharding(ISharding sharding)
 {
     _sharding = sharding;
     return(this);
 }
Ejemplo n.º 11
0
 public static IHydra Create(ISharding sharding)
 {
     return(new Hydra().SetSharding(sharding));
 }