public List <AllocationCandidate> GetAllocationCandidates(Guid shardId, string type) { //Get all nodes that are contactable var activeNodes = _stateMachine.GetNodes().Where(node => node.IsContactable); ShardAllocationMetadata shard = _stateMachine.GetShard(type, shardId); List <AllocationCandidate> nodes = new List <AllocationCandidate>(); foreach (var activeNode in activeNodes) { //If it is neither stale or insync, allocate the node if (!shard.InsyncAllocations.Contains(activeNode.Id) && !shard.StaleAllocations.Contains(activeNode.Id)) { nodes.Add(new AllocationCandidate() { NodeId = activeNode.Id, Type = shard.Type }); } } return(nodes); }