private static List<TokenRange> createRange(String ... hosts) { List<TokenRange> ret = new LinkedList<TokenRange>(); for(final String h: hosts) { TokenRange tr1 = Mockito.mock(TokenRange.class); Mockito.when(tr1.getEndpoint_details()).thenReturn(new LinkedList<EndpointDetails>(){{ add(new EndpointDetails(h, "DC1")); }}); ret.add(tr1); } return ret; } }
public Object getFieldValue(_Fields field) { switch (field) { case HOST: return getHost(); case DATACENTER: return getDatacenter(); case RACK: return getRack(); } throw new IllegalStateException(); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case HOST: if (value == null) { unsetHost(); } else { setHost((String)value); } break; case DATACENTER: if (value == null) { unsetDatacenter(); } else { setDatacenter((String)value); } break; case RACK: if (value == null) { unsetRack(); } else { setRack((String)value); } break; } }
private EndpointDetails createDetails(String dc, String rack, String host) { EndpointDetails details = new EndpointDetails(host, dc); return details.setRack(rack); } }
|| dataCenterValidator.validate(endPointDetail.getDatacenter())) { CassandraHost foundHost = new CassandraHost(endPointDetail.getHost(), cassandraHostConfigurator.getPort()); if (!existingHosts.contains(foundHost)) {
/** * Performs a deep copy on <i>other</i>. */ public EndpointDetails(EndpointDetails other) { if (other.isSetHost()) { this.host = other.host; } if (other.isSetDatacenter()) { this.datacenter = other.datacenter; } if (other.isSetRack()) { this.rack = other.rack; } }
_elem64 = new EndpointDetails(); _elem64.read(iprot); struct.endpoint_details.add(_elem64);
public void write(org.apache.thrift.protocol.TProtocol oprot, EndpointDetails struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.host != null) { oprot.writeFieldBegin(HOST_FIELD_DESC); oprot.writeString(struct.host); oprot.writeFieldEnd(); } if (struct.datacenter != null) { oprot.writeFieldBegin(DATACENTER_FIELD_DESC); oprot.writeString(struct.datacenter); oprot.writeFieldEnd(); } if (struct.rack != null) { if (struct.isSetRack()) { oprot.writeFieldBegin(RACK_FIELD_DESC); oprot.writeString(struct.rack); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
private static List<TokenRange> retrieveNodeRanges() throws InvalidRequestException, TException { List<TokenRange> nodeRanges = new LinkedList<TokenRange>(); List<TokenRange> localRing = client.describe_local_ring(keyspace); for (TokenRange tokenRange : localRing) { List<EndpointDetails> rangeEndpoints = tokenRange.getEndpoint_details(); for (EndpointDetails endpointDetails : rangeEndpoints) { if (nodeIp.equals(endpointDetails.getHost())) { nodeRanges.add(tokenRange); } if (firstRangeOnly) break; } } return nodeRanges; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof EndpointDetails) return this.equals((EndpointDetails)that); return false; }
if (isSetRack()) { if (!first) sb.append(", "); sb.append("rack:");
/** * Performs a deep copy on <i>other</i>. */ public EndpointDetails(EndpointDetails other) { if (other.isSetHost()) { this.host = other.host; } if (other.isSetDatacenter()) { this.datacenter = other.datacenter; } if (other.isSetRack()) { this.rack = other.rack; } }
_elem64 = new EndpointDetails(); _elem64.read(iprot); struct.endpoint_details.add(_elem64);
if (dataCenterValidator.validate(endPointDetail.getDatacenter())) { CassandraHost foundHost = new CassandraHost(endPointDetail.getHost(), cassandraHostConfigurator.getPort()); if ( !existingHosts.contains(foundHost) ) { log.info("Found a node we don't know about {} for TokenRange {}", foundHost, tokenRange);
public void write(org.apache.thrift.protocol.TProtocol oprot, EndpointDetails struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.host != null) { oprot.writeFieldBegin(HOST_FIELD_DESC); oprot.writeString(struct.host); oprot.writeFieldEnd(); } if (struct.datacenter != null) { oprot.writeFieldBegin(DATACENTER_FIELD_DESC); oprot.writeString(struct.datacenter); oprot.writeFieldEnd(); } if (struct.rack != null) { if (struct.isSetRack()) { oprot.writeFieldBegin(RACK_FIELD_DESC); oprot.writeString(struct.rack); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof EndpointDetails) return this.equals((EndpointDetails)that); return false; }
if (isSetRack()) { if (!first) sb.append(", "); sb.append("rack:");
public Object getFieldValue(_Fields field) { switch (field) { case HOST: return getHost(); case DATACENTER: return getDatacenter(); case RACK: return getRack(); } throw new IllegalStateException(); }