Exemplo n.º 1
0
        public async Task StartAsync()
        {
            await Disseminator.StartAsync();

            await Transport.StartAsync();

            await FailureDetector.StartAsync();

            await MembershipMonitor.StartAsync();
        }
Exemplo n.º 2
0
        public async Task LeaveAsync()
        {
            // TODO tell others?

            await MembershipMonitor.StopAsync();

            await FailureDetector.StopAsync();

            await Transport.StopAsync();

            await Disseminator.StopAsync();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public SwimTransport(ITransport transport, Disseminator disseminator, IMessageSerializer messageSerializer)
 {
     _transport         = transport;
     _disseminator      = disseminator;
     _messageSerializer = messageSerializer;
 }