public static List <BatchNode> GenerateList ( Cluster cluster, BatchPolicy policy, Key[] keys, uint sequenceAP, uint sequenceSC, BatchNode batchSeed ) { Node[] nodes = cluster.Nodes; if (nodes.Length == 0) { throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Command failed because cluster is empty."); } // Create initial key capacity for each node as average + 25%. int keysPerNode = batchSeed.offsetsSize / nodes.Length; keysPerNode += (int)((uint)keysPerNode >> 2); // The minimum key capacity is 10. if (keysPerNode < 10) { keysPerNode = 10; } Replica replica = policy.replica; Replica replicaSC = Partition.GetReplicaSC(policy); // Split keys by server node. List <BatchNode> batchNodes = new List <BatchNode>(nodes.Length); for (int i = 0; i < batchSeed.offsetsSize; i++) { int offset = batchSeed.offsets[i]; Node node = Partition.GetNodeBatchRead(cluster, keys[offset], replica, replicaSC, sequenceAP, sequenceSC); BatchNode batchNode = FindBatchNode(batchNodes, node); if (batchNode == null) { batchNodes.Add(new BatchNode(node, keysPerNode, offset)); } else { batchNode.AddKey(offset); } } return(batchNodes); }
public static List <BatchNode> GenerateList ( Cluster cluster, BatchPolicy policy, Key[] keys, uint sequenceAP, uint sequenceSC, BatchNode batchSeed ) { Node[] nodes = cluster.ValidateNodes(); // Create initial key capacity for each node as average + 25%. int keysPerNode = batchSeed.offsetsSize / nodes.Length; keysPerNode += (int)((uint)keysPerNode >> 2); // The minimum key capacity is 10. if (keysPerNode < 10) { keysPerNode = 10; } Replica replica = policy.replica; Replica replicaSC = Partition.GetReplicaSC(policy); // Split keys by server node. List <BatchNode> batchNodes = new List <BatchNode>(nodes.Length); for (int i = 0; i < batchSeed.offsetsSize; i++) { int offset = batchSeed.offsets[i]; Node node = Partition.GetNodeBatchRead(cluster, keys[offset], replica, replicaSC, sequenceAP, sequenceSC); BatchNode batchNode = FindBatchNode(batchNodes, node); if (batchNode == null) { batchNodes.Add(new BatchNode(node, keysPerNode, offset)); } else { batchNode.AddKey(offset); } } return(batchNodes); }
public static List <BatchNode> GenerateList(Cluster cluster, BatchPolicy policy, List <BatchRead> records) { Node[] nodes = cluster.Nodes; if (nodes.Length == 0) { throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Command failed because cluster is empty."); } // Create initial key capacity for each node as average + 25%. int max = records.Count; int keysPerNode = max / nodes.Length; keysPerNode += (int)((uint)keysPerNode >> 2); // The minimum key capacity is 10. if (keysPerNode < 10) { keysPerNode = 10; } Replica replica = policy.replica; Replica replicaSC = Partition.GetReplicaSC(policy); // Split keys by server node. List <BatchNode> batchNodes = new List <BatchNode>(nodes.Length); for (int i = 0; i < max; i++) { Node node = Partition.GetNodeBatchRead(cluster, records[i].key, replica, replicaSC, 0, 0); BatchNode batchNode = FindBatchNode(batchNodes, node); if (batchNode == null) { batchNodes.Add(new BatchNode(node, keysPerNode, i)); } else { batchNode.AddKey(i); } } return(batchNodes); }
public static List <BatchNode> GenerateList(Cluster cluster, BatchPolicy policy, Key[] keys) { Node[] nodes = cluster.Nodes; if (nodes.Length == 0) { throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Command failed because cluster is empty."); } // Create initial key capacity for each node as average + 25%. int keysPerNode = keys.Length / nodes.Length; keysPerNode += (int)((uint)keysPerNode >> 2); // The minimum key capacity is 10. if (keysPerNode < 10) { keysPerNode = 10; } // Split keys by server node. List <BatchNode> batchNodes = new List <BatchNode>(nodes.Length); for (int i = 0; i < keys.Length; i++) { Partition partition = new Partition(keys[i]); Node node = cluster.GetMasterNode(partition); BatchNode batchNode = FindBatchNode(batchNodes, node); if (batchNode == null) { batchNodes.Add(new BatchNode(node, keysPerNode, i)); } else { batchNode.AddKey(i); } } return(batchNodes); }
public static List <BatchNode> GenerateList(Cluster cluster, BatchPolicy policy, List <BatchRead> records) { Node[] nodes = cluster.ValidateNodes(); // Create initial key capacity for each node as average + 25%. int max = records.Count; int keysPerNode = max / nodes.Length; keysPerNode += (int)((uint)keysPerNode >> 2); // The minimum key capacity is 10. if (keysPerNode < 10) { keysPerNode = 10; } Replica replica = policy.replica; Replica replicaSC = Partition.GetReplicaSC(policy); // Split keys by server node. List <BatchNode> batchNodes = new List <BatchNode>(nodes.Length); for (int i = 0; i < max; i++) { Node node = Partition.GetNodeBatchRead(cluster, records[i].key, replica, replicaSC, 0, 0); BatchNode batchNode = FindBatchNode(batchNodes, node); if (batchNode == null) { batchNodes.Add(new BatchNode(node, keysPerNode, i)); } else { batchNode.AddKey(i); } } return(batchNodes); }