Package org.elasticsearch.test.gateway
Class TestGatewayAllocator
- java.lang.Object
-
- org.elasticsearch.gateway.GatewayAllocator
-
- org.elasticsearch.test.gateway.TestGatewayAllocator
-
public class TestGatewayAllocator extends GatewayAllocator
A gateway allocator implementation that keeps an in memory list of started shard allocation that are used as replies to the, normally async, fetch data requests. The in memory list is adapted when shards are started and failed. Nodes leaving and joining the cluster do not change the list of shards the class tracks but rather serves as a filter to what is returned by fetch data. Concretely - fetch data will only return shards that were started on nodes that are currently part of the cluster. For now only primary shard related data is fetched. Replica request always get an empty response. This class is useful to use in unit tests that require the functionality ofGatewayAllocatorbut do not have all the infrastructure required to use it.
-
-
Constructor Summary
Constructors Constructor Description TestGatewayAllocator()
-
Method Summary
Modifier and Type Method Description voidaddKnownAllocation(ShardRouting shard)manually add a specific shard to the allocations the gateway keeps track ofvoidallocateUnassigned(RoutingAllocation allocation)voidapplyFailedShards(RoutingAllocation allocation, java.util.List<FailedShard> failedShards)voidapplyStartedShards(RoutingAllocation allocation, java.util.List<ShardRouting> startedShards)-
Methods inherited from class org.elasticsearch.gateway.GatewayAllocator
decideUnassignedShardAllocation, getNumberOfInFlightFetch, innerAllocatedUnassigned
-
-
-
-
Method Detail
-
applyStartedShards
public void applyStartedShards(RoutingAllocation allocation, java.util.List<ShardRouting> startedShards)
- Overrides:
applyStartedShardsin classGatewayAllocator
-
applyFailedShards
public void applyFailedShards(RoutingAllocation allocation, java.util.List<FailedShard> failedShards)
- Overrides:
applyFailedShardsin classGatewayAllocator
-
allocateUnassigned
public void allocateUnassigned(RoutingAllocation allocation)
- Overrides:
allocateUnassignedin classGatewayAllocator
-
addKnownAllocation
public void addKnownAllocation(ShardRouting shard)
manually add a specific shard to the allocations the gateway keeps track of
-
-