Example #1
0
        private async Task OnFailure(GuidId subscriptionId, string streamProviderName, IStreamIdentity streamIdentity,
                                     StreamSequenceToken sequenceToken)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException("subscriptionId");
            }
            if (string.IsNullOrWhiteSpace(streamProviderName))
            {
                throw new ArgumentNullException("streamProviderName");
            }
            if (streamIdentity == null)
            {
                throw new ArgumentNullException("streamIdentity");
            }

            var failureEntity = createEntity();

            failureEntity.SubscriptionId     = subscriptionId.Guid;
            failureEntity.StreamProviderName = streamProviderName;
            failureEntity.StreamGuid         = streamIdentity.Guid;
            failureEntity.StreamNamespace    = streamIdentity.Namespace;
            failureEntity.SetSequenceToken(this.serializationManager, sequenceToken);
            failureEntity.SetPartitionKey(deploymentId);
            failureEntity.SetRowkey();
            await dataManager.CreateTableEntryAsync(failureEntity);
        }
Example #2
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;
            }
Example #3
0
            public async Task Write(GrainStateRecord record)
            {
                GrainStateEntity entity = record.Entity;

                if (logger.IsVerbose3)
                {
                    logger.Verbose3((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(record.Entity) :
                              await tableManager.UpdateTableEntryAsync(entity, record.ETag);

                record.ETag = eTag;
            }
Example #4
0
 /// <summary>
 /// Try once to insert a new data entry in the Azure table. Returns false if there is a conflict.
 /// </summary>
 private async Task <bool> TryCreateTableEntryAsync(GossipTableEntry data, [CallerMemberName] string operation = null)
 {
     return(await TryOperation(() => storage.CreateTableEntryAsync(data), operation));
 }