public void Start(int nodeId) { IEmulatedNode node = null; lock (sync_nodes) { nodes.TryGetValue(nodeId, out node); } //var node = nodes.Where(r => r.NodeAddress.NodeAddressId == nodeId).FirstOrDefault(); if (node != null) { if (node is TcpRaftNode) { if (!((TcpRaftNode)node).Disposed) { return; } node = null; TcpRaftNode trn = null; lock (sync_nodes) { trn = new TcpRaftNode(new NodeSettings() { TcpClusterEndPoints = eps, RaftEntitiesSettings = new List <RaftEntitySettings> { re_settings } }, @"D:\Temp\RaftDBreeze\node" + nodeId, new DefaultHandler(), nodeId, null, this); nodes[trn.GetNodeByEntityName("default").NodeAddress.NodeAddressId] = trn; } trn.Start(); } else { node.EmulationStart(); } } }
///// <summary> ///// Test method ///// </summary> ///// <param name="nodeId"></param> ///// <param name="stateLogId"></param> ///// <returns></returns> //public bool ContainsStateLogIdData(int nodeId, ulong stateLogId) //{ // IEmulatedNode node = null; // lock (sync_nodes) // { // nodes.TryGetValue(nodeId, out node); // } // //var node = nodes.Where(r => r.NodeAddress.NodeAddressId == nodeId).FirstOrDefault(); // if (node == null) // return false; // return ((RaftNode)node).ContainsStateLogEntryId(stateLogId); //} public void Start(int nodeId) { IEmulatedNode node = null; lock (sync_nodes) { nodes.TryGetValue(nodeId, out node); } //var node = nodes.Where(r => r.NodeAddress.NodeAddressId == nodeId).FirstOrDefault(); if (node != null) { if (node is TcpRaftNode) { if (!((TcpRaftNode)node).Disposed) { return; } node = null; TcpRaftNode trn = null; lock (sync_nodes) { trn = new TcpRaftNode(new NodeSettings() { TcpClusterEndPoints = eps, RaftEntitiesSettings = new List <RaftEntitySettings> { re_settings } }, @"D:\Temp\RaftDBreeze\node" + nodeId, (entityName, index, data) => { Console.WriteLine($"wow committed {entityName}/{index}"); return(true); }, nodeId, this); nodes[trn.GetNodeByEntityName("default").NodeAddress.NodeAddressId] = trn; } trn.Start(); } else { node.EmulationStart(); } } }