private ReminderEntry ConvertFromTableEntry(ReminderTableEntry tableEntry, string eTag) { try { return(new ReminderEntry { GrainRef = this.grainReferenceConverter.GetGrainFromKeyString(tableEntry.GrainReference), ReminderName = tableEntry.ReminderName, StartAt = LogFormatter.ParseDate(tableEntry.StartAt), Period = TimeSpan.Parse(tableEntry.Period), ETag = eTag, }); } catch (Exception exc) { var error = $"Failed to parse ReminderTableEntry: {tableEntry}. This entry is corrupt, going to ignore it."; logger.Error((int)AzureUtils.Utilities.ErrorCode.AzureTable_49, error, exc); throw; } finally { string serviceIdStr = ReminderTableEntry.ConstructServiceIdStr(remTableManager.ServiceId); if (!tableEntry.ServiceId.Equals(serviceIdStr)) { var error = $"Read a reminder entry for wrong Service id. Read {tableEntry}, but my service id is {serviceIdStr}. Going to discard it."; logger.Warn((int)AzureUtils.Utilities.ErrorCode.AzureTable_ReadWrongReminder, error); throw new OrleansException(error); } } }
private static ReminderTableEntry ConvertToTableEntry(ReminderEntry remEntry, Guid serviceId, string deploymentId) { string partitionKey = ReminderTableEntry.ConstructPartitionKey(serviceId, remEntry.GrainRef); string rowKey = ReminderTableEntry.ConstructRowKey(remEntry.GrainRef, remEntry.ReminderName); string serviceIdStr = ReminderTableEntry.ConstructServiceIdStr(serviceId); var consistentHash = remEntry.GrainRef.GetUniformHashCode(); return(new ReminderTableEntry { PartitionKey = partitionKey, RowKey = rowKey, ServiceId = serviceIdStr, DeploymentId = deploymentId, GrainReference = remEntry.GrainRef.ToKeyString(), ReminderName = remEntry.ReminderName, StartAt = LogFormatter.PrintDate(remEntry.StartAt), Period = remEntry.Period.ToString(), GrainRefConsistentHash = String.Format("{0:X8}", consistentHash), ETag = remEntry.ETag, }); }
private ReminderEntry ConvertFromTableEntry(ReminderTableEntry tableEntry, string eTag) { try { return(new ReminderEntry { GrainRef = GrainReference.FromKeyString(tableEntry.GrainReference), ReminderName = tableEntry.ReminderName, StartAt = TraceLogger.ParseDate(tableEntry.StartAt), Period = TimeSpan.Parse(tableEntry.Period), ETag = eTag, }); } catch (Exception exc) { var error = String.Format("Failed to parse ReminderTableEntry: {0}. This entry is corrupt, going to ignore it.", tableEntry); logger.Error(ErrorCode.AzureTable_49, error, exc); throw; } finally { string serviceIdStr = ReminderTableEntry.ConstructServiceIdStr(remTableManager.ServiceId); if (!tableEntry.ServiceId.Equals(serviceIdStr)) { var error = String.Format("Read a reminder entry for wrong Service id. Read {0}, but my service id is {1}. Going to discard it.", tableEntry, serviceIdStr); logger.Warn(ErrorCode.AzureTable_ReadWrongReminder, error); throw new ApplicationException(error); } } }