@Test public void testAddNode() { NodeGroup group = new NodeGroup(new NodeEndpoint("A", "localhost", 2333)); group.addNode(new NodeEndpoint("B", "localhost", 2334), 10, 0, false); Assert.assertFalse(group.findMember(NodeId.of("B")).isMajor()); }
GroupMember addNode(NodeEndpoint endpoint, int nextIndex, int matchIndex, boolean major) { logger.info("add node {} to group", endpoint.getId()); ReplicatingState replicatingState = new ReplicatingState(nextIndex, matchIndex); GroupMember member = new GroupMember(endpoint, replicatingState, major); memberMap.put(endpoint.getId(), member); return member; }
NodeGroup { GroupMember addNode(NodeEndpoint endpoint, int nextIndex, int matchIndex, boolean major) { logger.info("add node {} to group", endpoint.getId()); ReplicatingState replicatingState = new ReplicatingState(nextIndex, matchIndex); GroupMember member = new GroupMember(endpoint, replicatingState, major); memberMap.put(endpoint.getId(), member); return member; } }
NodeGroup { GroupMember addNode(NodeEndpoint endpoint, int nextIndex, int matchIndex, boolean major) { logger.info("add node {} to group", endpoint.getId()); ReplicatingState replicatingState = new ReplicatingState(nextIndex, matchIndex); GroupMember member = new GroupMember(endpoint, replicatingState, major); memberMap.put(endpoint.getId(), member); return member; } NodeGroup(NodeEndpoint endpoint);   NodeGroup(Collection<NodeEndpoint> endpoints, NodeId selfId); }
NodeGroup { GroupMember addNode(NodeEndpoint endpoint, int nextIndex, int matchIndex, boolean major) { logger.info("add node {} to group", endpoint.getId()); ReplicatingState replicatingState = new ReplicatingState(nextIndex, matchIndex); GroupMember member = new GroupMember(endpoint, replicatingState, major); memberMap.put(endpoint.getId(), member); return member; } NodeGroup(NodeEndpoint endpoint);   NodeGroup(Collection<NodeEndpoint> endpoints, NodeId selfId);  }
NodeGroup { GroupMember addNode(NodeEndpoint endpoint, int nextIndex, int matchIndex, boolean major) { logger.info("add node {} to group", endpoint.getId()); ReplicatingState replicatingState = new ReplicatingState(nextIndex, matchIndex); GroupMember member = new GroupMember(endpoint, replicatingState, major); memberMap.put(endpoint.getId(), member); return member; } NodeGroup(NodeEndpoint endpoint);   NodeGroup(Collection<NodeEndpoint> endpoints, NodeId selfId);   }