Example #1
0
        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);
        }
Example #2
0
 // Check if a data node is dead
 private bool IsDataNodeDead(DataNodeInfo dn)
 {
     return(dn.LastUpdateTicks < _timeProvider.Now.AddMilliseconds(-HeartBeatExpireIntervalMilliseconds).Ticks);
 }