Esempio n. 1
0
            public Task WriteWithoutEtagCheck(GrainStateRecord record)
            {
                var 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);
                }
                return(tableManager.UpsertTableEntryAsync(entity));
            }
Esempio n. 2
0
        /// <summary>
        /// Updates the checkpoint.  This is a best effort.  It does not always update the checkpoint.
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="utcNow"></param>
        public void Update(string offset, DateTime utcNow)
        {
            // if offset has not changed, do nothing
            if (string.Compare(entity.Offset, offset, StringComparison.Ordinal) == 0)
            {
                return;
            }

            // if we've saved before but it's not time for another save or the last save operation has not completed, do nothing
            if (throttleSavesUntilUtc.HasValue && (throttleSavesUntilUtc.Value > utcNow || !inProgressSave.IsCompleted))
            {
                return;
            }

            entity.Offset         = offset;
            throttleSavesUntilUtc = utcNow + persistInterval;
            inProgressSave        = dataManager.UpsertTableEntryAsync(entity);
            inProgressSave.Ignore();
        }