public async Task StartAsync() { await Disseminator.StartAsync(); await Transport.StartAsync(); await FailureDetector.StartAsync(); await MembershipMonitor.StartAsync(); }
public async Task LeaveAsync() { // TODO tell others? await MembershipMonitor.StopAsync(); await FailureDetector.StopAsync(); await Transport.StopAsync(); await Disseminator.StopAsync(); }
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); }
public SwimTransport(ITransport transport, Disseminator disseminator, IMessageSerializer messageSerializer) { _transport = transport; _disseminator = disseminator; _messageSerializer = messageSerializer; }