public Guid AddDataNode(IDataNodeId descriptor) { // Allocate an ID for the data node var dataNodeGuid = Guid.NewGuid(); // Persist the data node information _dataNodes[dataNodeGuid] = new DataNodeInfo { DataNodeId = descriptor, LastUpdateTicks = _timeProvider.Now.Ticks }; // Return the data node ID return(dataNodeGuid); }
// Check if a data node is dead private bool IsDataNodeDead(DataNodeInfo dn) { return(dn.LastUpdateTicks < _timeProvider.Now.AddMilliseconds(-HeartBeatExpireIntervalMilliseconds).Ticks); }