Ejemplo n.º 1
0
        private static EndPoint[] GetGossipCandidates(EndPoint[] gossipSeeds)
        {
            var endpoints = new EndPoint[gossipSeeds.Length];

            Array.Copy(gossipSeeds, endpoints, gossipSeeds.Length);
            endpoints.RandomShuffle(0, endpoints.Length - 1);
            return(endpoints);
        }
Ejemplo n.º 2
0
        private static EndPoint[] ArrangeGossipCandidates(IReadOnlyList <ClusterMessages.MemberInfo> members)
        {
            var result = new EndPoint[members.Count];
            int i      = -1;
            int j      = members.Count;

            for (int k = 0; k < members.Count; ++k)
            {
                if (members[k].State == ClusterMessages.VNodeState.Manager)
                {
                    result[--j] = members[k].EndPoint;
                }
                else
                {
                    result[++i] = members[k].EndPoint;
                }
            }

            result.RandomShuffle(0, i);
            result.RandomShuffle(j, members.Count - 1);

            return(result);
        }