Exemple #1
0
 private SiloInstanceRecord ConvertPartial(MembershipEntry memEntry)
 {
     return(new SiloInstanceRecord
     {
         DeploymentId = this.deploymentId,
         IAmAliveTime = memEntry.IAmAliveTime,
         SiloIdentity = SiloInstanceRecord.ConstructSiloIdentity(memEntry.SiloAddress)
     });
 }
Exemple #2
0
        private MembershipEntry Parse(SiloInstanceRecord tableEntry)
        {
            var parse = new MembershipEntry
            {
                HostName = tableEntry.HostName,
                Status   = (SiloStatus)tableEntry.Status
            };

            parse.ProxyPort = tableEntry.ProxyPort;

            parse.SiloAddress = SiloAddress.New(new IPEndPoint(IPAddress.Parse(tableEntry.Address), tableEntry.Port), tableEntry.Generation);

            if (!string.IsNullOrEmpty(tableEntry.SiloName))
            {
                parse.SiloName = tableEntry.SiloName;
            }

            parse.StartTime = tableEntry.StartTime;

            parse.IAmAliveTime = tableEntry.IAmAliveTime;

            var suspectingSilos = new List <SiloAddress>();
            var suspectingTimes = new List <DateTime>();

            if (!string.IsNullOrEmpty(tableEntry.SuspectingSilos))
            {
                string[] silos = tableEntry.SuspectingSilos.Split('|');
                foreach (string silo in silos)
                {
                    suspectingSilos.Add(SiloAddress.FromParsableString(silo));
                }
            }

            if (!string.IsNullOrEmpty(tableEntry.SuspectingTimes))
            {
                string[] times = tableEntry.SuspectingTimes.Split('|');
                foreach (string time in times)
                {
                    suspectingTimes.Add(LogFormatter.ParseDate(time));
                }
            }

            if (suspectingSilos.Count != suspectingTimes.Count)
            {
                throw new OrleansException(string.Format("SuspectingSilos.Length of {0} as read from Firebase table is not equal to SuspectingTimes.Length of {1}", suspectingSilos.Count, suspectingTimes.Count));
            }

            for (int i = 0; i < suspectingSilos.Count; i++)
            {
                parse.AddSuspector(suspectingSilos[i], suspectingTimes[i]);
            }

            return(parse);
        }
Exemple #3
0
        private SiloInstanceRecord ConvertEntry(MembershipEntry memEntry)
        {
            var tableEntry = new SiloInstanceRecord
            {
                DeploymentId = this.deploymentId,
                Address      = memEntry.SiloAddress.Endpoint.Address.ToString(),
                Port         = memEntry.SiloAddress.Endpoint.Port,
                Generation   = memEntry.SiloAddress.Generation,
                HostName     = memEntry.HostName,
                Status       = (int)memEntry.Status,
                ProxyPort    = memEntry.ProxyPort,
                SiloName     = memEntry.SiloName,
                StartTime    = memEntry.StartTime,
                IAmAliveTime = memEntry.IAmAliveTime,
                SiloIdentity = SiloInstanceRecord.ConstructSiloIdentity(memEntry.SiloAddress)
            };

            if (memEntry.SuspectTimes != null)
            {
                var  siloList = new StringBuilder();
                var  timeList = new StringBuilder();
                bool first    = true;
                foreach (var tuple in memEntry.SuspectTimes)
                {
                    if (!first)
                    {
                        siloList.Append('|');
                        timeList.Append('|');
                    }

                    siloList.Append(tuple.Item1.ToParsableString());
                    timeList.Append(LogFormatter.PrintDate(tuple.Item2));
                    first = false;
                }

                tableEntry.SuspectingSilos = siloList.ToString();
                tableEntry.SuspectingTimes = timeList.ToString();
            }
            else
            {
                tableEntry.SuspectingSilos = string.Empty;
                tableEntry.SuspectingTimes = string.Empty;
            }

            return(tableEntry);
        }