protected GossipServiceBase(IPublisher bus, IGossipSeedSource gossipSeedSource, VNodeInfo nodeInfo, TimeSpan gossipInterval, TimeSpan allowedTimeDifference, TimeSpan gossipTimeout, TimeSpan deadMemberRemovalPeriod, ITimeProvider timeProvider, Func <MemberInfo[], MemberInfo> getNodeToGossipTo = null) { Ensure.NotNull(bus, "bus"); Ensure.NotNull(gossipSeedSource, "gossipSeedSource"); Ensure.NotNull(nodeInfo, "nodeInfo"); Ensure.NotNull(timeProvider, nameof(timeProvider)); _bus = bus; _publishEnvelope = new PublishEnvelope(bus); _gossipSeedSource = gossipSeedSource; NodeInfo = nodeInfo; GossipInterval = gossipInterval; AllowedTimeDifference = allowedTimeDifference; GossipTimeout = gossipTimeout; DeadMemberRemovalPeriod = deadMemberRemovalPeriod; _state = GossipState.Startup; _timeProvider = timeProvider; _getNodeToGossipTo = getNodeToGossipTo ?? GetNodeToGossipTo; }
public void Handle(GossipMessage.RetrieveGossipSeedSources message) { _state = GossipState.RetrievingGossipSeeds; try { _gossipSeedSource.BeginGetHostEndpoints(OnGotGossipSeedSources, null); } catch (Exception ex) { Log.Error(ex, "Error while retrieving cluster members through DNS."); _bus.Publish(TimerMessage.Schedule.Create(DnsRetryTimeout, _publishEnvelope, new GossipMessage.RetrieveGossipSeedSources())); } }
public void Handle(GossipMessage.GotGossipSeedSources message) { var now = DateTime.UtcNow; var dnsCluster = new ClusterInfo( message.GossipSeeds.Select(x => MemberInfo.ForManager(Guid.Empty, now, true, x, x)).ToArray()); var oldCluster = _cluster; _cluster = MergeClusters(_cluster, dnsCluster, null, x => x); LogClusterChange(oldCluster, _cluster, null); _state = GossipState.Working; Handle(new GossipMessage.Gossip(0)); // start gossiping }
protected GossipServiceBase(IPublisher bus, IGossipSeedSource gossipSeedSource, VNodeInfo nodeInfo) { Ensure.NotNull(bus, "bus"); Ensure.NotNull(gossipSeedSource, "gossipSeedSource"); Ensure.NotNull(nodeInfo, "nodeInfo"); _bus = bus; _publishEnvelope = new PublishEnvelope(bus); _gossipSeedSource = gossipSeedSource; NodeInfo = nodeInfo; _state = GossipState.Startup; }
public void Handle(GossipMessage.GotGossipSeedSources message) { var now = _timeProvider.UtcNow; var dnsCluster = new ClusterInfo( message.GossipSeeds.Select(x => MemberInfo.ForManager(Guid.Empty, now, true, x, x)).ToArray()); var oldCluster = _cluster; _cluster = MergeClusters(_cluster, dnsCluster, null, x => x, _timeProvider.UtcNow, NodeInfo, CurrentLeader, AllowedTimeDifference, DeadMemberRemovalPeriod); LogClusterChange(oldCluster, _cluster, null); _state = GossipState.Working; Handle(new GossipMessage.Gossip(0)); }
protected GossipServiceBase(IPublisher bus, IGossipSeedSource gossipSeedSource, VNodeInfo nodeInfo, TimeSpan gossipInterval, TimeSpan allowedTimeDifference) { Ensure.NotNull(bus, "bus"); Ensure.NotNull(gossipSeedSource, "gossipSeedSource"); Ensure.NotNull(nodeInfo, "nodeInfo"); _bus = bus; _publishEnvelope = new PublishEnvelope(bus); _gossipSeedSource = gossipSeedSource; NodeInfo = nodeInfo; GossipInterval = gossipInterval; AllowedTimeDifference = allowedTimeDifference; _state = GossipState.Startup; }
public Join(GossipState state, Member member) { State = state; Member = member; }
private bool HasTimedOut(GossipState state) => unchecked (Environment.TickCount - state.CreationTickCount) >= Configuration.AntiEntropyIdleTimeout;
public NewMember(GossipState state, Member member) { State = state; Member = member; }
public RingRequest(ulong term, GossipState state, Member target) { Term = term; State = state; Target = target; }
public Ping(ulong term, GossipState state) { Term = term; State = state; }
public Ack(ulong term, GossipState state) { Term = term; State = state; }
private bool HasTimedOut(GossipState state) => unchecked (TransactionalTickCount.Value - state.CreationTickCount) >= Configuration.AntiEntropyIdleTimeout;