public class ShardStrategyFactory extends ArrayBasedStrategyFactory
| Modifier and Type | Field and Description |
|---|---|
protected int |
cacheSize
Size of the memory cache (0 = disabled)
|
protected java.util.function.Function<java.lang.String,java.lang.Long> |
hash
Default hash function (MD5).
|
protected java.lang.Integer |
ringSize
Ring size (optional)
|
protected java.lang.String |
shardKey
Shard key's path (eg.
|
protected int |
vnodes
Number of virtual nodes
|
preferLocalbroker, logger, name| Constructor and Description |
|---|
ShardStrategyFactory()
Constructor that calls for service based primarily on its own
(hash-based) logic.
|
ShardStrategyFactory(boolean preferLocal)
Constructor that can be configured to use local services if possible.
|
ShardStrategyFactory(boolean preferLocal,
java.lang.String shardKey)
Constructor that can be configured to use local services if possible.
|
ShardStrategyFactory(java.lang.String shardKey)
Constructor that can be configured to use local services if possible.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Endpoint> |
create() |
int |
getCacheSize() |
java.util.function.Function<java.lang.String,java.lang.Long> |
getHash() |
java.lang.Integer |
getRingSize() |
java.lang.String |
getShardKey() |
int |
getVnodes() |
void |
setCacheSize(int cacheSize) |
void |
setHash(java.util.function.Function<java.lang.String,java.lang.Long> hash) |
void |
setRingSize(java.lang.Integer ringSize) |
void |
setShardKey(java.lang.String shardKey) |
void |
setVnodes(int vnodes) |
isPreferLocal, setPreferLocalprotected java.lang.String shardKey
protected int vnodes
protected java.lang.Integer ringSize
protected int cacheSize
protected java.util.function.Function<java.lang.String,java.lang.Long> hash
public ShardStrategyFactory()
public ShardStrategyFactory(boolean preferLocal)
preferLocal - invoke local actions if possiblepublic ShardStrategyFactory(java.lang.String shardKey)
shardKey - Shard key's path (eg. "userID", "user.email", "#key", etc.)public ShardStrategyFactory(boolean preferLocal,
java.lang.String shardKey)
preferLocal - invoke local actions if possibleshardKey - Shard key's path (eg. "userID", "user.email", "#key", etc.)public <T extends Endpoint> Strategy<T> create()
create in class StrategyFactorypublic java.lang.String getShardKey()
public void setShardKey(java.lang.String shardKey)
public int getVnodes()
public void setVnodes(int vnodes)
public java.lang.Integer getRingSize()
public void setRingSize(java.lang.Integer ringSize)
public int getCacheSize()
public void setCacheSize(int cacheSize)
public java.util.function.Function<java.lang.String,java.lang.Long> getHash()
public void setHash(java.util.function.Function<java.lang.String,java.lang.Long> hash)