• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UniqueAddress类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UniqueAddress的典型用法代码示例。如果您正苦于以下问题:C# UniqueAddress类的具体用法?C# UniqueAddress怎么用?C# UniqueAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UniqueAddress类属于命名空间,在下文中一共展示了UniqueAddress类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Record

 public Record(UniqueAddress observer, UniqueAddress subject, ReachabilityStatus status, long version)
 {
     _observer = observer;
     _subject = subject;
     _status = status;
     _version = version;
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:7,代码来源:Reachability.cs


示例2: EchoConsumerActor

        public EchoConsumerActor(ClusterNodeContext context)
        {
            _clusterContext = context;
            _clusterUniqueAddress = Cluster.Get(Context.System).SelfUniqueAddress;

            Receive<string>(m => OnMessage(m));
        }
开发者ID:SaladLab,项目名称:Akka.Cluster.Utility,代码行数:7,代码来源:EchoConsumerActor.cs


示例3: Fd

 private FailureDetectorStub Fd(ClusterHeartbeatSenderState state, UniqueAddress node)
 {
     return
         state.FailureDetector.AsInstanceOf<DefaultFailureDetectorRegistry<Address>>()
             .GetFailureDetector(node.Address)
             .AsInstanceOf<FailureDetectorStub>();
 }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:7,代码来源:ClusterHeartBeatSenderStateSpec.cs


示例4: MemberCreate

        /// <summary>
        /// Creates a member from internal Akka method
        /// </summary>
        /// <returns>The new member</returns>
        public static Member MemberCreate(UniqueAddress uniqueAddress, int upNumber, MemberStatus status, ImmutableHashSet<string> roles)
        {
            var createMethod =
                typeof(Member).GetMethods(BindingFlags.NonPublic | BindingFlags.Static)
                .First(m => m.Name == "Create" && m.GetParameters().Length == 4);

            return (Member)createMethod.Invoke(null, new object[] { uniqueAddress, upNumber, status, roles });
        }
开发者ID:kantora,项目名称:ClusterKit,代码行数:12,代码来源:ClusterExtensions.cs


示例5: ClusterMessages_must_be_serializable

        public void ClusterMessages_must_be_serializable()
        {
            var address = new Address("akka.tcp", "system", "some.host.org", 4711);
            var uniqueAddress = new UniqueAddress(address, 17);
            var address2 = new Address("akka.tcp", "system", "other.host.org", 4711);
            var uniqueAddress2 = new UniqueAddress(address2, 18);
            CheckSerialization(new InternalClusterAction.Join(uniqueAddress, ImmutableHashSet.Create("foo","bar")));
            CheckSerialization(new ClusterUserAction.Leave(address));
            CheckSerialization(new ClusterUserAction.Down(address));
            CheckSerialization(new InternalClusterAction.InitJoin());
            CheckSerialization(new InternalClusterAction.InitJoinAck(address));
            CheckSerialization(new InternalClusterAction.InitJoinNack(address));
            CheckSerialization(new ClusterHeartbeatSender.Heartbeat(address));
            CheckSerialization(new ClusterHeartbeatSender.HeartbeatRsp(uniqueAddress));

            var node1 = new VectorClock.Node("node1");
            var node2 = new VectorClock.Node("node2");
            var node3 = new VectorClock.Node("node3");
            var node4 = new VectorClock.Node("node4");
            var g1 =
                new Gossip(ImmutableSortedSet.Create(a1, b1, c1, d1)).Increment(node1)
                    .Increment(node2)
                    .Seen(a1.UniqueAddress)
                    .Seen(b1.UniqueAddress);
            var g2 = g1.Increment(node3).Increment(node4).Seen(a1.UniqueAddress).Seen(c1.UniqueAddress);
            var reachability3 =
                Reachability.Empty.Unreachable(a1.UniqueAddress, e1.UniqueAddress)
                    .Unreachable(b1.UniqueAddress, e1.UniqueAddress);
            var g3 = g2.Copy(members: ImmutableSortedSet.Create(a1, b1, c1, d1, e1),
                overview: g2.Overview.Copy(reachability: reachability3));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g1));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g2));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g3));

            CheckSerialization(new GossipStatus(a1.UniqueAddress, g1.Version));
            CheckSerialization(new GossipStatus(a1.UniqueAddress, g2.Version));
            CheckSerialization(new GossipStatus(a1.UniqueAddress, g3.Version));

            CheckSerialization(new InternalClusterAction.Welcome(uniqueAddress, g2));

            var mg = new MetricsGossip(ImmutableHashSet.Create<NodeMetrics>(new[]
            {
                new NodeMetrics(a1.Address, 4711, ImmutableHashSet.Create<Metric>(new Metric("foo", 1.2, null))),
                new NodeMetrics(b1.Address, 4712,
                    ImmutableHashSet.Create<Metric>(new Metric("foo", 2.1, new EWMA(100.0, 0.18))
                        , new Metric("bar1", Double.MinValue, null), new Metric("bar2", float.MaxValue, null),
                        new Metric("bar3", int.MaxValue, null), new Metric("bar4", long.MaxValue, null), 
                        new Metric("bar5", double.MaxValue, null)))
            }));
            CheckSerialization(new MetricsGossipEnvelope(a1.Address, mg, true));
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:51,代码来源:ClusterMessageSerializerSpec.cs


示例6: ClusterMessages_must_be_serializable

        public void ClusterMessages_must_be_serializable()
        {
            var address = new Address("akka.tcp", "system", "some.host.org", 4711);
            var uniqueAddress = new UniqueAddress(address, 17);
            var address2 = new Address("akka.tcp", "system", "other.host.org", 4711);
            var uniqueAddress2 = new UniqueAddress(address2, 18);
            CheckSerialization(new InternalClusterAction.Join(uniqueAddress, ImmutableHashSet.Create("foo","bar")));
            CheckSerialization(new ClusterUserAction.Leave(address));
            CheckSerialization(new ClusterUserAction.Down(address));
            CheckSerialization(new InternalClusterAction.InitJoin());
            CheckSerialization(new InternalClusterAction.InitJoinAck(address));
            CheckSerialization(new InternalClusterAction.InitJoinNack(address));
            CheckSerialization(new ClusterHeartbeatSender.Heartbeat(address));
            CheckSerialization(new ClusterHeartbeatSender.HeartbeatRsp(uniqueAddress));

            var node1 = new VectorClock.Node("node1");
            var node2 = new VectorClock.Node("node2");
            var node3 = new VectorClock.Node("node3");
            var node4 = new VectorClock.Node("node4");
            var g1 =
                new Gossip(ImmutableSortedSet.Create(a1, b1, c1, d1)).Increment(node1)
                    .Increment(node2)
                    .Seen(a1.UniqueAddress)
                    .Seen(b1.UniqueAddress);
            var g2 = g1.Increment(node3).Increment(node4).Seen(a1.UniqueAddress).Seen(c1.UniqueAddress);
            var reachability3 =
                Reachability.Empty.Unreachable(a1.UniqueAddress, e1.UniqueAddress)
                    .Unreachable(b1.UniqueAddress, e1.UniqueAddress);
            var g3 = g2.Copy(members: ImmutableSortedSet.Create(a1, b1, c1, d1, e1),
                overview: g2.Overview.Copy(reachability: reachability3));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g1));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g2));
            CheckSerialization(new GossipEnvelope(a1.UniqueAddress, uniqueAddress2, g3));

            CheckSerialization(new GossipStatus(a1.UniqueAddress, g1.Version));
            CheckSerialization(new GossipStatus(a1.UniqueAddress, g2.Version));
            CheckSerialization(new GossipStatus(a1.UniqueAddress, g3.Version));

            CheckSerialization(new InternalClusterAction.Welcome(uniqueAddress, g2));
        }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:40,代码来源:ClusterMessageSerializerSpec.cs


示例7: NextVersion

 long NextVersion(UniqueAddress observer)
 {
     return CurrentVersion(observer) + 1;
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:4,代码来源:Reachability.cs


示例8: Terminated

 public Reachability Terminated(UniqueAddress observer, UniqueAddress subject)
 {
     return Change(observer, subject, ReachabilityStatus.Terminated);
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:4,代码来源:Reachability.cs


示例9: CurrentVersion

 long CurrentVersion(UniqueAddress observer)
 {
     long version;
     return _versions.TryGetValue(observer, out version) ? version : 0;
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:5,代码来源:Reachability.cs


示例10: RecordsFrom

 public ImmutableList<Record> RecordsFrom(UniqueAddress observer)
 {
     var rows = ObserverRows(observer);
     if (rows == null) return ImmutableList.Create<Record>();
     return rows.Values.ToImmutableList();
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:6,代码来源:Reachability.cs


示例11: Status

 public ReachabilityStatus Status(UniqueAddress node)
 {
     if (_cache.Value.AllTerminated.Contains(node)) return ReachabilityStatus.Terminated;
     if (_cache.Value.AllUnreachable.Contains(node)) return ReachabilityStatus.Unreachable;
     return ReachabilityStatus.Reachable;
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:6,代码来源:Reachability.cs


示例12: IsReachable

 public bool IsReachable(UniqueAddress observer, UniqueAddress subject)
 {
     return Status(observer, subject) == ReachabilityStatus.Reachable;
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:4,代码来源:Reachability.cs


示例13: Change

        private Reachability Change(UniqueAddress observer, UniqueAddress subject, ReachabilityStatus status)
        {
            var v = NextVersion(observer);
            var newVersions = _versions.SetItem(observer, v);
            var newRecord = new Record(observer, subject, status, v);
            var oldObserverRows = ObserverRows(observer);
            if (oldObserverRows == null && status == ReachabilityStatus.Reachable) return this;
            if (oldObserverRows == null) return new Reachability(_records.Add(newRecord), newVersions);

            Record oldRecord = null;
            oldObserverRows.TryGetValue(subject, out oldRecord);
            if (oldRecord == null)
            {
                if (status == ReachabilityStatus.Reachable &&
                    oldObserverRows.Values.All(r => r.Status == ReachabilityStatus.Reachable))
                {
                    return new Reachability(_records.FindAll(r => !r.Observer.Equals(observer)), newVersions);
                }
                return new Reachability(_records.Add(newRecord), newVersions);
            }
            if (oldRecord.Status == ReachabilityStatus.Terminated || oldRecord.Status == status)
                return this;

            if(status == ReachabilityStatus.Reachable && 
                oldObserverRows.Values.All(r => r.Status == ReachabilityStatus.Reachable || r.Subject.Equals(subject)))
                return new Reachability(_records.FindAll(r => !r.Observer.Equals(observer)), newVersions);

            var newRecords = _records.SetItem(_records.IndexOf(oldRecord), newRecord);
            return new Reachability(newRecords, newVersions);
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:30,代码来源:Reachability.cs


示例14: ObserverRows

        ImmutableDictionary<UniqueAddress, Record> ObserverRows(UniqueAddress observer)
        {
            ImmutableDictionary<UniqueAddress, Record> observerRows = null;
            _cache.Value.ObserverRowMap.TryGetValue(observer, out observerRows);

            return observerRows;
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:7,代码来源:Reachability.cs


示例15: AllUnreachableFrom

 public ImmutableHashSet<UniqueAddress> AllUnreachableFrom(UniqueAddress observer)
 {
     var observerRows = ObserverRows(observer);
     if (observerRows == null) return ImmutableHashSet.Create<UniqueAddress>();
     return
         ImmutableHashSet.CreateRange(
             observerRows.Where(p => p.Value.Status == ReachabilityStatus.Unreachable).Select(p => p.Key));
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:8,代码来源:Reachability.cs


示例16: Reachable

 public Reachability Reachable(UniqueAddress observer, UniqueAddress subject)
 {
     return Change(observer, subject, ReachabilityStatus.Reachable);
 }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:4,代码来源:Reachability.cs


示例17: EmptyState

 private static ClusterHeartbeatSenderState EmptyState(UniqueAddress selfUniqueAddress)
 {
     return new ClusterHeartbeatSenderState(new HeartbeatNodeRing(selfUniqueAddress, new[] { selfUniqueAddress }, 3),
         ImmutableHashSet.Create<UniqueAddress>(), new DefaultFailureDetectorRegistry<Address>(() => new FailureDetectorStub()));
 }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:5,代码来源:ClusterHeartBeatSenderStateSpec.cs



注:本文中的UniqueAddress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UniqueId类代码示例发布时间:2022-05-24
下一篇:
C# Union类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap