本文整理汇总了C#中SiloAddress.ToLongString方法的典型用法代码示例。如果您正苦于以下问题:C# SiloAddress.ToLongString方法的具体用法?C# SiloAddress.ToLongString怎么用?C# SiloAddress.ToLongString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiloAddress
的用法示例。
在下文中一共展示了SiloAddress.ToLongString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRow
public async Task<MembershipTableData> ReadRow(SiloAddress key)
{
try
{
var entries = await tableManager.FindSiloEntryAndTableVersionRow(key);
MembershipTableData data = Convert(entries);
if (logger.IsVerbose2) logger.Verbose2("Read my entry {0} Table=" + Environment.NewLine + "{1}", key.ToLongString(), data.ToString());
return data;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.AzureTable_20, String.Format("Intermediate error reading silo entry for key {0} from the table {1}.",
key.ToLongString(), tableManager.TableName), exc);
throw;
}
}
示例2: GetApproximateSiloStatus
// ONLY access localTableCopy and not the localTable, to prevent races, as this method may be called outside the turn.
internal SiloStatus GetApproximateSiloStatus(SiloAddress siloAddress)
{
var status = SiloStatus.None;
if (siloAddress.Equals(MyAddress))
{
status = CurrentStatus;
}
else
{
if (!localTableCopy.TryGetValue(siloAddress, out status))
{
if (CurrentStatus.Equals(SiloStatus.Active))
if (logger.IsVerbose) logger.Verbose(ErrorCode.Runtime_Error_100209, "-The given siloAddress {0} is not registered in this MembershipOracle.", siloAddress.ToLongString());
status = SiloStatus.None;
}
}
if (logger.IsVerbose3) logger.Verbose3("-GetApproximateSiloStatus returned {0} for silo: {1}", status, siloAddress.ToLongString());
return status;
}
示例3: ReadRow
public async Task<MembershipTableData> ReadRow(SiloAddress siloAddress)
{
try
{
var keys = new Dictionary<string, AttributeValue>
{
{ $"{SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME}", new AttributeValue(deploymentId) },
{ $"{SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME}", new AttributeValue(SiloInstanceRecord.ConstructSiloIdentity(siloAddress)) }
};
var entry = await storage.ReadSingleEntryAsync(TABLE_NAME_DEFAULT_VALUE, keys, fields => new SiloInstanceRecord(fields));
MembershipTableData data = entry != null ? Convert(new List<SiloInstanceRecord> { entry }) : new MembershipTableData(_tableVersion);
if (logger.IsVerbose2) logger.Verbose2("Read my entry {0} Table=" + Environment.NewLine + "{1}", siloAddress.ToLongString(), data.ToString());
return data;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.MembershipBase,
$"Intermediate error reading silo entry for key {siloAddress.ToLongString()} from the table {TABLE_NAME_DEFAULT_VALUE}.", exc);
throw;
}
}
示例4: FindSiloEntryAndTableVersionRow
internal async Task<List<Tuple<SiloInstanceTableEntry, string>>> FindSiloEntryAndTableVersionRow(SiloAddress siloAddress)
{
string rowKey = SiloInstanceTableEntry.ConstructRowKey(siloAddress);
Expression<Func<SiloInstanceTableEntry, bool>> query = instance =>
instance.PartitionKey == DeploymentId
&& (instance.RowKey == rowKey || instance.RowKey == SiloInstanceTableEntry.TABLE_VERSION_ROW);
var queryResults = await storage.ReadTableEntriesAndEtagsAsync(query);
var asList = queryResults.ToList();
if (asList.Count < 1 || asList.Count > 2)
throw new KeyNotFoundException(string.Format("Could not find table version row or found too many entries. Was looking for key {0}, found = {1}", siloAddress.ToLongString(), Utils.EnumerableToString(asList)));
int numTableVersionRows = asList.Count(tuple => tuple.Item1.RowKey == SiloInstanceTableEntry.TABLE_VERSION_ROW);
if (numTableVersionRows < 1)
throw new KeyNotFoundException(string.Format("Did not read table version row. Read = {0}", Utils.EnumerableToString(asList)));
if (numTableVersionRows > 1)
throw new KeyNotFoundException(string.Format("Read {0} table version rows, while was expecting only 1. Read = {1}", numTableVersionRows, Utils.EnumerableToString(asList)));
return asList;
}
示例5: FindSiloEntryAndTableVersionRow
internal async Task<List<Tuple<SiloInstanceTableEntry, string>>> FindSiloEntryAndTableVersionRow(SiloAddress siloAddress)
{
string rowKey = SiloInstanceTableEntry.ConstructRowKey(siloAddress);
string filterOnPartitionKey = TableQuery.GenerateFilterCondition(nameof(SiloInstanceTableEntry.PartitionKey), QueryComparisons.Equal,
this.DeploymentId);
string filterOnRowKey1 = TableQuery.GenerateFilterCondition(nameof(SiloInstanceTableEntry.RowKey), QueryComparisons.Equal,
rowKey);
string filterOnRowKey2 = TableQuery.GenerateFilterCondition(nameof(SiloInstanceTableEntry.RowKey), QueryComparisons.Equal, SiloInstanceTableEntry.TABLE_VERSION_ROW);
string query = TableQuery.CombineFilters(filterOnPartitionKey, TableOperators.And, TableQuery.CombineFilters(filterOnRowKey1, TableOperators.Or, filterOnRowKey2));
var queryResults = await storage.ReadTableEntriesAndEtagsAsync(query);
var asList = queryResults.ToList();
if (asList.Count < 1 || asList.Count > 2)
throw new KeyNotFoundException(string.Format("Could not find table version row or found too many entries. Was looking for key {0}, found = {1}", siloAddress.ToLongString(), Utils.EnumerableToString(asList)));
int numTableVersionRows = asList.Count(tuple => tuple.Item1.RowKey == SiloInstanceTableEntry.TABLE_VERSION_ROW);
if (numTableVersionRows < 1)
throw new KeyNotFoundException(string.Format("Did not read table version row. Read = {0}", Utils.EnumerableToString(asList)));
if (numTableVersionRows > 1)
throw new KeyNotFoundException(string.Format("Read {0} table version rows, while was expecting only 1. Read = {1}", numTableVersionRows, Utils.EnumerableToString(asList)));
return asList;
}
示例6: NotifyLocalSubscribers
private void NotifyLocalSubscribers(SiloAddress siloAddress, SiloStatus newStatus)
{
if (logger.IsVerbose2) logger.Verbose2("-NotifyLocalSubscribers about {0} status {1}", siloAddress.ToLongString(), newStatus);
List<ISiloStatusListener> copy;
lock (statusListeners)
{
copy = statusListeners.ToList();
}
foreach (ISiloStatusListener listener in copy)
{
try
{
listener.SiloStatusChangeNotification(siloAddress, newStatus);
}
catch (Exception exc)
{
logger.Error(ErrorCode.MembershipLocalSubscriberException,
String.Format("Local ISiloStatusListener {0} has thrown an exception when was notified about SiloStatusChangeNotification about silo {1} new status {2}",
listener.GetType().FullName, siloAddress.ToLongString(), newStatus), exc);
}
}
}
示例7: IsLocatedOnSilo
public Task<bool> IsLocatedOnSilo(SiloAddress siloAddress)
{
return Task.FromResult(RuntimeIdentity == siloAddress.ToLongString());
}