public MembershipMonitor(MembershipList membership, SwimTransport transport, FailureDetector failureDetector, MembershipMonitorOptions options) { _transport = transport; _failureDetector = failureDetector; _options = options; _membership = membership; }
public FailureDetector(SwimTransport transport, MembershipList membershipList, FailureDetectorOptions options) { _transport = transport; _membershipList = membershipList; _options = options; _timer = new Timer { Interval = _options.PingInterval.TotalMilliseconds, AutoReset = true }; _timer.Elapsed += TickPing; }
public SwimClient(SwimHost local, SwimMeta initialMeta, SwimClientOptions options) { Local = local; Members = new MembershipList(local, initialMeta); Disseminator = new Disseminator(Members, new DisseminatorOptions()); Transport = new SwimTransport(new UdpTransport(local, new UdpTransportOptions()), Disseminator, options.MessageSerializer); FailureDetector = new FailureDetector(Transport, Members, new FailureDetectorOptions(options.Logger)); MembershipMonitor = new MembershipMonitor(Members, Transport, FailureDetector, new MembershipMonitorOptions()); Members.OnJoined += (_, args) => options.Logger.Information("Host {host} joined", args.Member.Host); Members.OnUpdated += (_, args) => options.Logger.Information("Host {host} updated", args.Member.Host); Members.OnLeft += (_, args) => options.Logger.Information("Host {host} left", args.Member.Host); }