forked from apache/cassandra-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for tablets routing information
Adds TabletInfo class to hold tablet support info on a per Host basis Adds TabletMap to hold currently known mappings Adds tablets-routing-v1 protocol extension negotiation Adds logic for parsing tablets routing information and using it under the hood. Adds TabletsIT
- Loading branch information
Showing
13 changed files
with
686 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
driver-core/src/main/java/com/datastax/driver/core/TabletInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.datastax.driver.core; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class TabletInfo { | ||
private static final String SCYLLA_TABLETS_STARTUP_OPTION_KEY = "TABLETS_ROUTING_V1"; | ||
private static final String SCYLLA_TABLETS_STARTUP_OPTION_VALUE = ""; | ||
public static final String TABLETS_ROUTING_V1_CUSTOM_PAYLOAD_KEY = "tablets-routing-v1"; | ||
|
||
private boolean enabled = false; | ||
|
||
private TabletInfo(boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
|
||
// Currently pertains only to TABLETS_ROUTING_V1 | ||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public static TabletInfo parseTabletInfo(Map<String, List<String>> supported) { | ||
List<String> values = supported.get(SCYLLA_TABLETS_STARTUP_OPTION_KEY); | ||
return new TabletInfo( | ||
values != null | ||
&& values.size() == 1 | ||
&& values.get(0).equals(SCYLLA_TABLETS_STARTUP_OPTION_VALUE)); | ||
} | ||
|
||
public static void addOption(Map<String, String> options) { | ||
options.put(SCYLLA_TABLETS_STARTUP_OPTION_KEY, SCYLLA_TABLETS_STARTUP_OPTION_VALUE); | ||
} | ||
} |
Oops, something went wrong.