Package org.infinispan.query.affinity
Class ShardAllocationManagerImpl
- java.lang.Object
-
- org.infinispan.query.affinity.ShardAllocationManagerImpl
-
- All Implemented Interfaces:
ShardAllocatorManager
public final class ShardAllocationManagerImpl extends java.lang.Object implements ShardAllocatorManager
- Since:
- 9.0
- See Also:
ShardAllocatorManager
-
-
Constructor Summary
Constructors Constructor Description ShardAllocationManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Address
getOwner(java.lang.String shardId)
java.lang.String
getShardFromKey(java.lang.Object key)
java.lang.String
getShardFromSegment(int segment)
java.util.Set<java.lang.String>
getShards()
java.util.Set<java.lang.String>
getShardsForModification(Address address)
void
initialize(int numberOfShards, int numSegments)
Initializes theShardAllocatorManager
with the configured number of segments and shards.void
inject(Cache<?,?> cache, DistributionManager distributionManager)
boolean
isOwnershipChanged(TopologyChangedEvent<?,?> tce, java.lang.String indeName)
void
onTopologyChange(TopologyChangedEvent<?,?> tce)
-
-
-
Method Detail
-
inject
public void inject(Cache<?,?> cache, DistributionManager distributionManager)
-
getShardFromSegment
public java.lang.String getShardFromSegment(int segment)
- Specified by:
getShardFromSegment
in interfaceShardAllocatorManager
- Returns:
- the shard name for a certain segment.
-
getOwner
public Address getOwner(java.lang.String shardId)
- Specified by:
getOwner
in interfaceShardAllocatorManager
- Returns:
- Owner of an index shard.
-
getShardFromKey
public java.lang.String getShardFromKey(java.lang.Object key)
- Specified by:
getShardFromKey
in interfaceShardAllocatorManager
-
initialize
public void initialize(int numberOfShards, int numSegments)
Description copied from interface:ShardAllocatorManager
Initializes theShardAllocatorManager
with the configured number of segments and shards.- Specified by:
initialize
in interfaceShardAllocatorManager
-
getShards
public java.util.Set<java.lang.String> getShards()
- Specified by:
getShards
in interfaceShardAllocatorManager
- Returns:
- the list of all shards available.
-
getShardsForModification
public java.util.Set<java.lang.String> getShardsForModification(Address address)
- Specified by:
getShardsForModification
in interfaceShardAllocatorManager
- Returns:
- the list of shards used to do modifications to the index for a given address.
-
isOwnershipChanged
public boolean isOwnershipChanged(TopologyChangedEvent<?,?> tce, java.lang.String indeName)
- Specified by:
isOwnershipChanged
in interfaceShardAllocatorManager
- Returns:
- Owner of an index shard given a certain
ConsistentHash
.
-
onTopologyChange
public void onTopologyChange(TopologyChangedEvent<?,?> tce)
-
-