Skip to content

Commit

Permalink
added debug outputs to node
Browse files Browse the repository at this point in the history
  • Loading branch information
Saetch committed Jun 29, 2024
1 parent 2e0678b commit 7110eb4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Cluster/Node_cs/NodeBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ private static int BinarySearchFittingNode(List<NodeResponse> hashValues, int ai
int upperBound = len -1;
int lowerBound = 0;
Console.WriteLine("Binary searching for NodeResponses: ");
foreach (NodeResponse node in hashValues){
Console.WriteLine(node.name + " " + node.hash);
}
Console.WriteLine("Trying to find node for hashValue: "+aimedValue);
while (true){
Console.WriteLine("Current index: "+index);
int currentValue = hashValues[index].hash;
int nextValue = hashValues[index + 1].hash;
if (aimedValue > currentValue && aimedValue <= nextValue){
Expand All @@ -150,9 +154,11 @@ private static int BinarySearchFittingNode(List<NodeResponse> hashValues, int ai
}
if(aimedValue > currentValue){
lowerBound = index+1;
Console.WriteLine("Increasing lowerBound to: "+lowerBound);
index += (upperBound - index)/2;
}else{
upperBound = index -1;
Console.WriteLine("Decreasing upperBound to: "+upperBound);
index -= Math.Max(1,(index - lowerBound)/2);
}
}
Expand Down

0 comments on commit 7110eb4

Please sign in to comment.