コード例 #1
0
        private void SaveAzureRangeShard(string shardSetName, long maxDistributionKey, string serverInstanceName,
                                         string catalog)
        {
            var repository      = new AzureRangeShardRepository();
            var azureRangeShard = GetAzureRangeShard(shardSetName, maxDistributionKey);

            if (azureRangeShard == null)
            {
                azureRangeShard =
                    new AzureRangeShard
                {
                    Catalog            = catalog,
                    MaxRange           = maxDistributionKey,
                    ServerInstanceName = serverInstanceName,
                    ShardSetName       = shardSetName
                };

                repository.Insert(azureRangeShard);
            }
            else
            {
                azureRangeShard.Catalog            = catalog;
                azureRangeShard.ServerInstanceName = serverInstanceName;

                repository.Merge(azureRangeShard);
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the Azure Range Shard for the shard set and distribution key
        /// </summary>
        /// <param name="shardSetName">Name of the shard set.</param>
        /// <param name="distributionKey">The distribution key.</param>
        /// <returns>AzureRangeShard.</returns>
        public AzureRangeShard GetAzureRangeShard(string shardSetName, long distributionKey)
        {
            var rowKey     = LongBasedRowKeyEntity.MakeRowKeyFromLong(distributionKey);
            var repository = new AzureRangeShardRepository();

            return(repository.Get(shardSetName, rowKey));
        }
コード例 #3
0
        private void DeleteAzureRangeShard(string shardSetName, long distributionKey)
        {
            var repository      = new AzureRangeShardRepository();
            var azureRangeShard = GetAzureRangeShard(shardSetName, distributionKey);

            if (azureRangeShard == null)
            {
                return;
            }

            repository.Delete(azureRangeShard);
        }
コード例 #4
0
        /// <summary>
        /// Initializes the azure tables for a shard set.
        /// </summary>
        /// <param name="shardSetName">Name of the shard set.</param>
        /// <param name="drop">if set to <c>true</c> [drop].</param>
        public static void InitializeAzureTables(string shardSetName, bool drop = false)
        {
            var azureShardletConnectionRepository = new AzureShardletConnectionRepository(shardSetName);

            azureShardletConnectionRepository.InitializeAzureTable(drop);

            var azureShardletMapRepository = new AzureShardletMapRepository(shardSetName);

            azureShardletMapRepository.InitializeAzureTable(drop);

            var azureRangeShardRepository = new AzureRangeShardRepository();

            azureRangeShardRepository.InitializeAzureTable(drop);
        }