/// <summary> /// Reads the member status from a stream. /// </summary> /// <param name="input">The input stream.</param> public ClusterMemberStatus(EnhancedStream input) { properties = input.ReadProperties(StringComparer.OrdinalIgnoreCase); try { string v; if (!properties.TryGetValue("_state", out v)) { this.State = ClusterMemberState.Unknown; } else { this.State = (ClusterMemberState)Enum.Parse(typeof(ClusterMemberState), v); } } catch { this.State = ClusterMemberState.Unknown; } this.Mode = this.Settings.Mode; this.InstanceEP = properties["_instance-ep"]; this.MachineName = properties["_machine-name"]; this.ProtocolCaps = (ClusterMemberProtocolCaps)int.Parse(properties["_caps"]); }
/// <summary> /// Constructor. /// </summary> /// <param name="senderEP">The sender instance endpoint.</param> /// <param name="protocolCaps">Indicates the sender's protocol implementation capabilities.</param> /// <param name="command">The command string.</param> /// <param name="data">The message BLOB data.</param> public ClusterMemberMsg(MsgEP senderEP, ClusterMemberProtocolCaps protocolCaps, string command, byte[] data) { base._Set("sender", (string)senderEP); base._Set("cmd", command); base._Set("caps", (int)protocolCaps); base._Set("flags", (int)ClusterMemberMsgFlag.None); base._Data = data; }
/// <summary> /// Constructor. /// </summary> /// <param name="masterEP">The master member endpoint.</param> /// <remarks> /// <note> /// <see cref="ReceiveTime" /> will be set to <see cref="DateTime.UtcNow" />. /// </note> /// </remarks> public ClusterStatus(MsgEP masterEP) { this.MasterEP = masterEP; this.MasterMachine = Helper.MachineName; this.MasterProtocolCaps = ClusterMemberProtocolCaps.Current; this.ReceiveTime = this.ClusterTime = DateTime.UtcNow; this.properties = new Dictionary <string, string>(); this.members = new List <ClusterMemberStatus>(); }
/// <summary> /// Constructor. /// </summary> /// <param name="instanceEP">The member's instance endpoint.</param> /// <param name="state">The member's current state.</param> /// <param name="settings">The cluster member's settings.</param> public ClusterMemberStatus(MsgEP instanceEP, ClusterMemberState state, ClusterMemberSettings settings) { this.InstanceEP = instanceEP; this.State = state; this.Mode = settings.Mode; this.MachineName = Helper.MachineName; this.ProtocolCaps = ClusterMemberProtocolCaps.Current; this.properties = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); settings.SaveTo(this); }
/// <summary> /// Constructs a <see cref="ClusterStatus" /> instance by reading from a stream. /// </summary> /// <param name="input">The input stream.</param> /// <remarks> /// <note> /// <see cref="ReceiveTime" /> will be initialized to <see cref="DateTime.UtcNow" />. /// </note> /// </remarks> public ClusterStatus(EnhancedStream input) { int count; this.properties = input.ReadProperties(StringComparer.OrdinalIgnoreCase); this.MasterEP = properties["_master-ep"]; this.MasterMachine = properties["_master-machine"]; this.MasterProtocolCaps = (ClusterMemberProtocolCaps)int.Parse(properties["_master-caps"]); this.ClusterTime = Helper.ParseInternetDate(properties["_cluster-time"]); this.ReceiveTime = DateTime.UtcNow; count = input.ReadInt16(); members = new List <ClusterMemberStatus>(count); for (int i = 0; i < count; i++) { members.Add(new ClusterMemberStatus(input)); } }