Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raizam/azurestorage.tablebatchgrouper
Makes Azure Storage Tables Batching seemless
https://github.com/raizam/azurestorage.tablebatchgrouper
Last synced: 3 days ago
JSON representation
Makes Azure Storage Tables Batching seemless
- Host: GitHub
- URL: https://github.com/raizam/azurestorage.tablebatchgrouper
- Owner: raizam
- Created: 2015-03-18T12:16:43.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-18T13:00:53.000Z (almost 10 years ago)
- Last Synced: 2024-11-20T05:58:18.085Z (2 months ago)
- Language: C#
- Size: 137 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AzureStorage.TableBatchGrouper
Makes Azure Storage Tables Batching seemless.##Usage
Once the project is referenced, an extension method is added to CloudTable:
```csharpCloudTable someTable;
ITableBatchGrouper grouper = someTable.CreateBatchGrouper();
```from an ITableBatchGrouper instance, table operations can be executed in an Atomic way, but are all batched internaly:
```csharp
public interface ITableBatchGrouper
{
Task Delete(ITableEntity entity);
Task Insert(ITableEntity entity);
Task InsertOrMerge(ITableEntity entity);
Task InsertOrReplace(ITableEntity entity);
Task Merge(ITableEntity entity);
Task Replace(ITableEntity entity);
void SetMaxDelayForPartition(string partition, TimeSpan delay);
void Dispose();
}
```An ITableBatchGrouper instance is thread safe, and may be used in a very long life cycle context.
##Configuration
Internaly, all ITableBatchGrouper instance (implemented internaly by TableBatchGrouperImpl) share the same System.Timers.Timer instance, and will dequeue incoming operations on a common tick.
By default the timer Interval is set to 2 seconds. You may want to change that:```csharp
//before the first Batchgrouper instanciation:
TableBatchGrouperExtensions.SharedTimerInterval = 2000;
```In azure Table Storage, batch are limited to 100 operations on the same partition.
Hence, the Batch operation is launched either when 100 operations is enqueued, or when the maximum wait delay is reached.
By default, this delay is set to 5 seconds, you may want to change that as well:
```csharp
TableBatchGrouperExtensions.DefaultMaxBatchDelay = TimeSpan.FromSeconds(10);
```This delay can be settled for specific partitions as well using ITableBatchGrouper.SetMaxDelayForPartition