public void Deserialize(Runtime.Serialization.IO.CompactReader reader) { topology = reader.ReadObject() as string; opTimeout = reader.ReadInt32(); statsRepInterval = reader.ReadInt32(); useHeartBeat = reader.ReadBoolean(); channel = reader.ReadObject() as Channel; bool nodeExists = reader.ReadBoolean(); if (nodeExists) { nodes = new Dictionary<NodeIdentity, StatusInfo>(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { nodes.Add(reader.ReadObject() as NodeIdentity , reader.ReadObject() as StatusInfo); } } }
public Cluster() { channel = new Channel(); nodes = new Dictionary<NodeIdentity, StatusInfo>(); }
private static Hashtable GetTcp(Channel channel, bool useHeartBeat) { Hashtable settings = new Hashtable(); settings.Add("start_port", channel.TcpPort.ToString()); settings.Add("port_range", channel.PortRange.ToString()); settings.Add("connection_retries", channel.ConnectionRetries); settings.Add("connection_retry_interval", channel.ConnectionRetryInterval); settings.Add("use_heart_beat", useHeartBeat); return settings; }
private static Hashtable GetGMS(Channel channel) { Hashtable settings = new Hashtable(); settings.Add("join_retry_count", channel.JoinRetries.ToString()); settings.Add("join_retry_timeout", channel.JoinRetryInterval.ToString()); return settings; }
private static Hashtable GetChannel(Channel channel, bool useHeartBeat) { Hashtable settings = new Hashtable(); settings.Add("tcp", GetTcp(channel, useHeartBeat)); settings.Add("tcpping", GetTcpPing(channel)); settings.Add("pbcast.gms", GetGMS(channel)); return settings; }
private static Hashtable GetTcpPing(Channel channel) { Hashtable settings = new Hashtable(); settings.Add("initial_hosts", channel.InitialHosts.ToString()); settings.Add("num_initial_members", channel.NumInitHosts.ToString()); settings.Add("port_range", channel.PortRange.ToString()); return settings; }
private static void GetGMS(Channel channel, Hashtable settings) { if (settings.ContainsKey("join_retry_count")) channel.JoinRetries = Convert.ToInt32(settings["join_retry_count"].ToString()); if (settings.ContainsKey("join_retry_timeout")) channel.JoinRetryInterval = Convert.ToInt32(settings["join_retry_timeout"]); }
private static void GetTcp(Channel channel, Hashtable settings) { if (settings.ContainsKey("start_port")) channel.TcpPort = Convert.ToInt32(settings["start_port"]); if (settings.ContainsKey("port_range")) channel.PortRange = Convert.ToInt32(settings["port_range"]); if (settings.ContainsKey("connection_retries")) channel.ConnectionRetries = Convert.ToInt32(settings["connection_retries"]); if (settings.ContainsKey("connection_retry_interval")) channel.ConnectionRetryInterval = Convert.ToInt32(settings["connection_retry_interval"]); }
private static void GetTcpPing(Channel channel, Hashtable settings) { if (settings.ContainsKey("initial_hosts")) channel.InitialHosts = settings["initial_hosts"].ToString(); if (settings.ContainsKey("num_initial_members")) channel.NumInitHosts = Convert.ToInt32(settings["num_initial_members"]); if (settings.ContainsKey("port_range")) channel.PortRange = Convert.ToInt32(settings["port_range"]); }
private static Channel GetChannel(Hashtable settings, int defaultPortRange) { Channel channel = new Channel(defaultPortRange); if (settings.ContainsKey("tcp")) GetTcp(channel, (Hashtable)settings["tcp"]); if (settings.ContainsKey("tcpping")) GetTcpPing(channel, (Hashtable)settings["tcpping"]); if (settings.ContainsKey("pbcast.gms")) GetGMS(channel, (Hashtable)settings["pbcast.gms"]); return channel; }
public object Clone() { Channel channel = new Channel(); channel.TcpPort = TcpPort; channel.PortRange = PortRange; channel.ConnectionRetries = ConnectionRetries; channel.ConnectionRetryInterval = ConnectionRetryInterval; channel.InitialHosts = InitialHosts != null ? (string) InitialHosts.Clone(): null; channel.NumInitHosts = NumInitHosts; return channel; }