本文整理汇总了C#中SiloAddress类的典型用法代码示例。如果您正苦于以下问题:C# SiloAddress类的具体用法?C# SiloAddress怎么用?C# SiloAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiloAddress类属于命名空间,在下文中一共展示了SiloAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SystemTarget
protected SystemTarget(GrainId grainId, SiloAddress silo, bool lowPriority)
{
GrainId = grainId;
Silo = silo;
ActivationId = ActivationId.GetSystemActivation(grainId, silo);
SchedulingContext = new SchedulingContext(this, lowPriority);
}
示例2: TypeManager
internal TypeManager(
SiloAddress myAddr,
GrainTypeManager grainTypeManager,
ISiloStatusOracle oracle,
OrleansTaskScheduler scheduler,
TimeSpan refreshClusterMapTimeout,
ImplicitStreamSubscriberTable implicitStreamSubscriberTable)
: base(Constants.TypeManagerId, myAddr)
{
if (grainTypeManager == null)
throw new ArgumentNullException(nameof(grainTypeManager));
if (oracle == null)
throw new ArgumentNullException(nameof(oracle));
if (scheduler == null)
throw new ArgumentNullException(nameof(scheduler));
if (implicitStreamSubscriberTable == null)
throw new ArgumentNullException(nameof(implicitStreamSubscriberTable));
this.grainTypeManager = grainTypeManager;
this.statusOracle = oracle;
this.implicitStreamSubscriberTable = implicitStreamSubscriberTable;
this.scheduler = scheduler;
this.hasToRefreshClusterGrainInterfaceMap = true;
this.refreshClusterGrainInterfaceMapTimer = new AsyncTaskSafeTimer(
OnRefreshClusterMapTimer,
null,
TimeSpan.Zero, // Force to do it once right now
refreshClusterMapTimeout);
}
示例3: TestMultiClusterGatewaySelection
public void TestMultiClusterGatewaySelection()
{
var candidates = new SiloAddress[] {
SiloAddress.New(new IPEndPoint(0,0),0),
SiloAddress.New(new IPEndPoint(0,0),1),
SiloAddress.New(new IPEndPoint(0,1),0),
SiloAddress.New(new IPEndPoint(0,1),1),
SiloAddress.New(new IPEndPoint(0,234),1),
SiloAddress.New(new IPEndPoint(1,0),0),
SiloAddress.New(new IPEndPoint(1,0),1),
SiloAddress.New(new IPEndPoint(1,1),1),
SiloAddress.New(new IPEndPoint(1,234),1),
SiloAddress.New(new IPEndPoint(2,234),1),
SiloAddress.New(new IPEndPoint(3,234),1),
SiloAddress.New(new IPEndPoint(4,234),1),
};
Func<SiloAddress,UpdateFaultCombo> group = (SiloAddress a) => new UpdateFaultCombo(a.Endpoint.Port, a.Generation);
// randomize order
var r = new Random();
var randomized = new SortedList<int,SiloAddress> ();
foreach(var c in candidates)
randomized.Add(r.Next(), c);
var x = MembershipOracleData.DeterministicBalancedChoice(randomized.Values, 10, group);
for (int i = 0; i < 10; i++)
Assert.Equal(candidates[i], x[i]);
}
示例4: AzureGossipTableTests
private AzureTableBasedGossipChannel gossipTable; // This type is internal
public AzureGossipTableTests()
{
logger = LogManager.GetLogger("AzureGossipTableTests", LoggerType.Application);
globalServiceId = Guid.NewGuid();
deploymentId = "test-" + globalServiceId;
IPAddress ip;
if (!IPAddress.TryParse("127.0.0.1", out ip))
{
logger.Error(-1, "Could not parse ip address");
return;
}
IPEndPoint ep1 = new IPEndPoint(ip, 21111);
siloAddress1 = SiloAddress.New(ep1, 0);
IPEndPoint ep2 = new IPEndPoint(ip, 21112);
siloAddress2 = SiloAddress.New(ep2, 0);
logger.Info("DeploymentId={0}", deploymentId);
GlobalConfiguration config = new GlobalConfiguration
{
ServiceId = globalServiceId,
ClusterId = "0",
DeploymentId = deploymentId,
DataConnectionString = TestDefaultConfiguration.DataConnectionString
};
gossipTable = new AzureTableBasedGossipChannel();
var done = gossipTable.Initialize(config.ServiceId, config.DataConnectionString);
if (!done.Wait(timeout))
{
throw new TimeoutException("Could not create/read table.");
}
}
示例5: ActivationAddress
private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status)
{
Silo = silo;
Grain = grain;
Activation = activation;
Status = status;
}
示例6: GetAddress
public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status = MultiClusterStatus.Owned)
{
// Silo part is not mandatory
if (grain == null) throw new ArgumentNullException("grain");
return new ActivationAddress(silo, grain, activation, status);
}
示例7: GetAddress
public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation)
{
// Silo part is not mandatory
if (grain == null) throw new ArgumentNullException("grain");
return new ActivationAddress(silo, grain, activation);
}
示例8: VirtualBucketsRingProvider
internal VirtualBucketsRingProvider(SiloAddress siloAddr, int nBucketsPerSilo)
{
if (nBucketsPerSilo <= 0 )
throw new IndexOutOfRangeException("numBucketsPerSilo is out of the range. numBucketsPerSilo = " + nBucketsPerSilo);
logger = TraceLogger.GetLogger(typeof(VirtualBucketsRingProvider).Name);
statusListeners = new List<IRingRangeListener>();
bucketsMap = new SortedDictionary<uint, SiloAddress>();
sortedBucketsList = new List<Tuple<uint, SiloAddress>>();
myAddress = siloAddr;
numBucketsPerSilo = nBucketsPerSilo;
lockable = new object();
running = true;
myRange = RangeFactory.CreateFullRange();
logger.Info("Starting {0} on silo {1}.", typeof(VirtualBucketsRingProvider).Name, siloAddr.ToStringWithHashCode());
StringValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_RING, ToString);
IntValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_RINGSIZE, () => GetRingSize());
StringValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_MYRANGE_RINGDISTANCE, () => String.Format("x{0,8:X8}", ((IRingRangeInternal)myRange).RangeSize()));
FloatValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_MYRANGE_RINGPERCENTAGE, () => (float)((IRingRangeInternal)myRange).RangePercentage());
FloatValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_AVERAGERINGPERCENTAGE, () =>
{
int size = GetRingSize();
return size == 0 ? 0 : ((float)100.0/(float) size);
});
// add myself to the list of members
AddServer(myAddress);
}
示例9: ForceGarbageCollection
public Task ForceGarbageCollection(SiloAddress[] siloAddresses)
{
var silos = GetSiloAddresses(siloAddresses);
logger.Info("Forcing garbage collection on {0}", Utils.EnumerableToString(silos));
List<Task> actionPromises = PerformPerSiloAction(silos,
s => GetSiloControlReference(s).ForceGarbageCollection());
return Task.WhenAll(actionPromises);
}
示例10: ClientObserverRegistrar
internal ClientObserverRegistrar(SiloAddress myAddr, ILocalGrainDirectory dir, OrleansTaskScheduler scheduler, ClusterConfiguration config)
: base(Constants.ClientObserverRegistrarId, myAddr)
{
grainDirectory = dir;
myAddress = myAddr;
this.scheduler = scheduler;
orleansConfig = config;
logger = LogManager.GetLogger(typeof(ClientObserverRegistrar).Name);
}
示例11: DuplicateActivationException
// Implementation of exception serialization with custom properties according to:
// http://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable
protected DuplicateActivationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
if (info != null)
{
ActivationToUse = (ActivationAddress) info.GetValue("ActivationToUse", typeof (ActivationAddress));
PrimaryDirectoryForGrain = (SiloAddress) info.GetValue("PrimaryDirectoryForGrain", typeof (SiloAddress));
}
}
示例12: GetImplicitStreamSubscriberTable
public Task<Streams.ImplicitStreamSubscriberTable> GetImplicitStreamSubscriberTable(SiloAddress silo)
{
Streams.ImplicitStreamSubscriberTable table = SiloProviderRuntime.Instance.ImplicitStreamSubscriberTable;
if (null == table)
{
throw new InvalidOperationException("the implicit stream subscriber table is not initialized");
}
return Task.FromResult(table);
}
示例13: TryGetSiloName
internal bool TryGetSiloName(SiloAddress siloAddress, out string siloName)
{
if (siloAddress.Equals(MyAddress))
{
siloName = SiloName;
return true;
}
return localNamesTableCopy.TryGetValue(siloAddress, out siloName);
}
示例14: Init
public async Task Init(string deploymentId, string storageConnectionString, SiloAddress siloAddress, string siloName, IPEndPoint gateway, string hostName)
{
this.deploymentId = deploymentId;
this.siloAddress = siloAddress;
this.siloName = siloName;
this.gateway = gateway;
myHostName = hostName;
storage = new AzureTableDataManager<SiloMetricsData>( INSTANCE_TABLE_NAME, storageConnectionString, logger);
await storage.InitTableAsync().WithTimeout(initTimeout);
}
示例15: SetLogLevel
public Task SetLogLevel(SiloAddress[] siloAddresses, string logName, int traceLevel)
{
var silos = GetSiloAddresses(siloAddresses);
logger.Info("SetLogLevel[{1}]={2} {0}", Utils.EnumerableToString(silos), logName, traceLevel);
List<Task> actionPromises = PerformPerSiloAction(silos,
s => GetSiloControlReference(s).SetLogLevel(logName, traceLevel));
return Task.WhenAll(actionPromises);
}