Exemple #1
0
        public AtsVolumeStorage(string tableName, string connectionString, IConcurrencyControl concurrency, IPartitionProvider <TKey> provider, IKeyConverter <TKey> keyConverter)
        {
            _cc                   = concurrency;
            _tableName            = tableName;
            _account              = CloudStorageAccount.Parse(connectionString);
            _client               = _account.CreateCloudTableClient();
            _partitioningProvider = provider;
            _keyConverter         = keyConverter;
            _defaultSelection     = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) };

            _client.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.JsonNoMetadata;
        }
Exemple #2
0
        public static string CalculateMinPartitionKey <TKey>(string id, TKey key, IPartitionProvider <TKey> provider)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(id);

            var partitionRange = provider.GetMinPartitioning(key);

            if (!string.IsNullOrEmpty(partitionRange))
            {
                builder.Append(Seperator)
                .Append(partitionRange);
            }

            return(builder.ToString());
        }
Exemple #3
0
        public CosmosTablesStorage(string tableName, string connectionString, int throughputUnits, IConcurrencyControl concurrency, IPartitionProvider <TKey> partitioningProvider, ITableProvider tableProvider, IKeyConverter <TKey> keyConverter)
        {
            _cc        = concurrency;
            _tableName = tableName;
            _account   = CloudStorageAccount.Parse(connectionString);
            var policy = new TableConnectionPolicy
            {
                EnableEndpointDiscovery             = true,
                MaxConnectionLimit                  = 1000,
                MaxRetryAttemptsOnThrottledRequests = 5,
                MaxRetryWaitTimeInSeconds           = 10,
                UseDirectMode  = false,
                UseTcpProtocol = false
            };

            _client = _account.CreateCloudTableClient(policy, ConsistencyLevel.Eventual);
            _partitioningProvider = partitioningProvider;
            _tableProvider        = tableProvider;
            _keyConverter         = keyConverter;
            _defaultSelection     = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) };
            _tables = new Dictionary <string, CloudTable>();
            _client.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.JsonNoMetadata;
            _throughputUnits = throughputUnits;
        }
Exemple #4
0
 public AtsDynamicStorage(string tableName, string connectionString, IConcurrencyControl concurrency, IPartitionProvider <TKey> partitioningProvider, ITableProvider tableProvider)
     : this(tableName, connectionString, concurrency, partitioningProvider, tableProvider, DefaultKeyConverter <TKey> .Current)
 {
 }
Exemple #5
0
 public AtsVolumeStorage(string tableName, string connectionString, IConcurrencyControl concurrency, IPartitionProvider <TKey> provider)
     : this(tableName, connectionString, concurrency, provider, DefaultKeyConverter <TKey> .Current)
 {
 }
Exemple #6
0
 public CosmosTablesStorage(string tableName, string connectionString, int throughputUnits, IConcurrencyControl concurrency, IPartitionProvider <TKey> partitioningProvider, ITableProvider tableProvider)
     : this(tableName, connectionString, throughputUnits, concurrency, partitioningProvider, tableProvider, DefaultKeyConverter <TKey> .Current)
 {
 }