Exemplo n.º 1
0
            public async Task Write(GrainStateRecord record)
            {
                var entity = record.Entity;

                if (logger.IsEnabled(LogLevel.Trace))
                {
                    logger.Trace((int)AzureProviderErrorCode.AzureTableProvider_Storage_Writing, "Writing: PartitionKey={0} RowKey={1} to Table={2} with ETag={3}", entity.PartitionKey, entity.RowKey, TableName, record.ETag);
                }
                string eTag = String.IsNullOrEmpty(record.ETag) ?
                              await tableManager.CreateTableEntryAsync(entity).ConfigureAwait(false) :
                              await tableManager.UpdateTableEntryAsync(entity, record.ETag).ConfigureAwait(false);

                record.ETag = eTag;
            }
Exemplo n.º 2
0
 /// <summary>
 /// Try once to conditionally update a data entry in the Azure table. Returns false if etag does not match.
 /// </summary>
 private async Task <bool> TryUpdateTableEntryAsync(GossipTableEntry data, string dataEtag, [CallerMemberName] string operation = null)
 {
     return(await TryOperation(() => storage.UpdateTableEntryAsync(data, dataEtag), operation));
 }