/// <summary>
 /// Initializes a new instance of the <see cref="AzureRangeShard"/> class.
 /// </summary>
 /// <param name="rangeShard">The range shard.</param>
 /// <param name="shardSetName">Name of the shard set.</param>
 public AzureRangeShard(RangeShard rangeShard, string shardSetName)
 {
     Catalog            = rangeShard.Catalog;
     MaxRange           = rangeShard.HighDistributionKey;
     ServerInstanceName = rangeShard.ServerInstanceName;
     ShardSetName       = shardSetName;
 }
        private ShardMap CreateSampleShardMap()
        {
            var map = new ShardMap
            {
                ShardMapID = 1
            };

            var shard =
                new RangeShard
            {
                LowDistributionKey  = -9223372036854775808,
                HighDistributionKey = -5534023222112865486
            };

            map.Shards.Add(shard);

            shard =
                new RangeShard
            {
                LowDistributionKey  = -5534023222112865485,
                HighDistributionKey = -1844674407370955164
            };

            map.Shards.Add(shard);

            shard =
                new RangeShard
            {
                LowDistributionKey  = -1844674407370955163,
                HighDistributionKey = 1844674407370955158
            };

            map.Shards.Add(shard);

            shard =
                new RangeShard
            {
                LowDistributionKey  = 1844674407370955159,
                HighDistributionKey = 5534023222112865480
            };

            map.Shards.Add(shard);

            shard =
                new RangeShard
            {
                LowDistributionKey  = 5534023222112865481,
                HighDistributionKey = 9223372036854775807
            };

            map.Shards.Add(shard);

            return(map);
        }
Пример #3
0
        private static RangeShard CreateShard(string catalog)
        {
            var server = ConfigurationManager.AppSettings["TestSQLServer"] ?? @"(localdb)\v11.0";

            var shard = new RangeShard
            {
                Catalog             = catalog,
                HighDistributionKey = 100,
                LowDistributionKey  = 0,
                ServerInstanceName  = server,
                ShardID             = 1
            };

            return(shard);
        }
Пример #4
0
 /// <summary>
 /// Removes the shard from the live shard map.
 /// </summary>
 /// <param name="shardSetName">Name of the shard set.</param>
 /// <param name="rangeShard">The shard.</param>
 public override void RemoveShard(string shardSetName, RangeShard rangeShard)
 {
     DeleteAzureRangeShard(shardSetName, rangeShard.HighDistributionKey);
 }
Пример #5
0
 /// <summary>
 /// Publishes the shard into the live shard map.
 /// </summary>
 /// <param name="shardSetName">Name of the shard set.</param>
 /// <param name="rangeShard">The shard.</param>
 public override void PublishShard(string shardSetName, RangeShard rangeShard)
 {
     SaveAzureRangeShard(shardSetName, rangeShard.HighDistributionKey, rangeShard.ServerInstanceName,
                         rangeShard.Catalog);
 }