public static EventStore.Cluster.ClusterInfo ToGrpcClusterInfo(ClusterInfo cluster) { var members = Array.ConvertAll(cluster.Members, x => new EventStore.Cluster.MemberInfo { InstanceId = Uuid.FromGuid(x.InstanceId).ToDto(), TimeStamp = x.TimeStamp.ToTicksSinceEpoch(), State = (EventStore.Cluster.MemberInfo.Types.VNodeState)x.State, IsAlive = x.IsAlive, ExternalHttp = new EventStore.Cluster.EndPoint( x.ExternalHttpEndPoint.Address.ToString(), (uint)x.ExternalHttpEndPoint.Port), InternalHttp = new EventStore.Cluster.EndPoint( x.InternalHttpEndPoint.Address.ToString(), (uint)x.InternalHttpEndPoint.Port), InternalTcp = new EventStore.Cluster.EndPoint( x.InternalTcpEndPoint.Address.ToString(), (uint)x.InternalTcpEndPoint.Port), ExternalTcp = new EventStore.Cluster.EndPoint( x.ExternalTcpEndPoint.Address.ToString(), (uint)x.ExternalTcpEndPoint.Port), LastCommitPosition = x.LastCommitPosition, WriterCheckpoint = x.WriterCheckpoint, ChaserCheckpoint = x.ChaserCheckpoint, EpochPosition = x.EpochPosition, EpochNumber = x.EpochNumber, EpochId = Uuid.FromGuid(x.EpochId).ToDto(), NodePriority = x.NodePriority, IsReadOnlyReplica = x.IsReadOnlyReplica }).ToArray(); var info = new EventStore.Cluster.ClusterInfo(); info.Members.AddRange(members); return(info); }
public static ClusterInfo FromGrpcClusterInfo(EventStore.Cluster.ClusterInfo grpcCluster) { var receivedMembers = Array.ConvertAll(grpcCluster.Members.ToArray(), x => new MemberInfo( Uuid.FromDto(x.InstanceId).ToGuid(), x.TimeStamp.FromTicksSinceEpoch(), (VNodeState)x.State, x.IsAlive, new IPEndPoint(IPAddress.Parse(x.InternalTcp.Address), (int)x.InternalTcp.Port), new IPEndPoint(IPAddress.Parse(x.ExternalTcp.Address), (int)x.ExternalTcp.Port), new IPEndPoint(IPAddress.Parse(x.InternalHttp.Address), (int)x.InternalHttp.Port), new IPEndPoint(IPAddress.Parse(x.ExternalHttp.Address), (int)x.ExternalHttp.Port), x.LastCommitPosition, x.WriterCheckpoint, x.ChaserCheckpoint, x.EpochPosition, x.EpochNumber, Uuid.FromDto(x.EpochId).ToGuid(), x.NodePriority, x.IsReadOnlyReplica )).ToArray(); return(new ClusterInfo(receivedMembers)); }
public static EventStore.Cluster.ClusterInfo ToGrpcClusterInfo(ClusterInfo cluster) { var members = Array.ConvertAll(cluster.Members, x => new EventStore.Cluster.MemberInfo { InstanceId = Uuid.FromGuid(x.InstanceId).ToDto(), TimeStamp = x.TimeStamp.ToTicksSinceEpoch(), State = (EventStore.Cluster.MemberInfo.Types.VNodeState)x.State, IsAlive = x.IsAlive, HttpEndPoint = new EventStore.Cluster.EndPoint( x.HttpEndPoint.GetHost(), (uint)x.HttpEndPoint.GetPort()), InternalTcp = x.InternalSecureTcpEndPoint != null ? new EventStore.Cluster.EndPoint( x.InternalSecureTcpEndPoint.GetHost(), (uint)x.InternalSecureTcpEndPoint.GetPort()) : new EventStore.Cluster.EndPoint( x.InternalTcpEndPoint.GetHost(), (uint)x.InternalTcpEndPoint.GetPort()), InternalTcpUsesTls = x.InternalSecureTcpEndPoint != null, ExternalTcp = x.ExternalSecureTcpEndPoint != null ? new EventStore.Cluster.EndPoint( x.ExternalSecureTcpEndPoint.GetHost(), (uint)x.ExternalSecureTcpEndPoint.GetPort()) : x.ExternalTcpEndPoint != null ? new EventStore.Cluster.EndPoint( x.ExternalTcpEndPoint.GetHost(), (uint)x.ExternalTcpEndPoint.GetPort()) : null, ExternalTcpUsesTls = x.ExternalSecureTcpEndPoint != null, LastCommitPosition = x.LastCommitPosition, WriterCheckpoint = x.WriterCheckpoint, ChaserCheckpoint = x.ChaserCheckpoint, EpochPosition = x.EpochPosition, EpochNumber = x.EpochNumber, EpochId = Uuid.FromGuid(x.EpochId).ToDto(), NodePriority = x.NodePriority, IsReadOnlyReplica = x.IsReadOnlyReplica, AdvertiseHostToClientAs = x.AdvertiseHostToClientAs ?? "", AdvertiseHttpPortToClientAs = (uint)x.AdvertiseHttpPortToClientAs, AdvertiseTcpPortToClientAs = (uint)x.AdvertiseTcpPortToClientAs }).ToArray(); var info = new EventStore.Cluster.ClusterInfo(); info.Members.AddRange(members); return(info); }
public static ClusterInfo FromGrpcClusterInfo(EventStore.Cluster.ClusterInfo grpcCluster) { var receivedMembers = Array.ConvertAll(grpcCluster.Members.ToArray(), x => new MemberInfo( Uuid.FromDto(x.InstanceId).ToGuid(), x.TimeStamp.FromTicksSinceEpoch(), (VNodeState)x.State, x.IsAlive, !x.InternalTcpUsesTls ? new DnsEndPoint(x.InternalTcp.Address, (int)x.InternalTcp.Port) : null, x.InternalTcpUsesTls ? new DnsEndPoint(x.InternalTcp.Address, (int)x.InternalTcp.Port) : null, !x.ExternalTcpUsesTls && x.ExternalTcp != null ? new DnsEndPoint(x.ExternalTcp.Address, (int)x.ExternalTcp.Port) : null, x.ExternalTcpUsesTls && x.ExternalTcp != null ? new DnsEndPoint(x.ExternalTcp.Address, (int)x.ExternalTcp.Port) : null, new DnsEndPoint(x.HttpEndPoint.Address, (int)x.HttpEndPoint.Port), x.AdvertiseHostToClientAs, (int)x.AdvertiseHttpPortToClientAs, (int)x.AdvertiseTcpPortToClientAs, x.LastCommitPosition, x.WriterCheckpoint, x.ChaserCheckpoint, x.EpochPosition, x.EpochNumber, Uuid.FromDto(x.EpochId).ToGuid(), x.NodePriority, x.IsReadOnlyReplica )).ToArray(); return(new ClusterInfo(receivedMembers)); }