Search in sources :

Example 1 with TestShardRouting.newShardRouting

use of org.elasticsearch.cluster.routing.TestShardRouting.newShardRouting in project crate by crate.

the class IndexShardTestCase method newShard.

/**
 * Creates a new initializing shard. The shard will have its own unique data path.
 *
 * @param primary       indicates whether to a primary shard (ready to recover from an empty store) or a replica (ready to recover from
 *                      another shard)
 * @param settings      the settings to use for this shard
 * @param engineFactory the engine factory to use for this shard
 */
protected IndexShard newShard(boolean primary, Settings settings, EngineFactory engineFactory) throws IOException {
    final RecoverySource recoverySource = primary ? RecoverySource.EmptyStoreRecoverySource.INSTANCE : RecoverySource.PeerRecoverySource.INSTANCE;
    final ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId("index", "_na_", 0), randomAlphaOfLength(10), primary, ShardRoutingState.INITIALIZING, recoverySource);
    return newShard(shardRouting, settings, engineFactory);
}
Also used : TestShardRouting(org.elasticsearch.cluster.routing.TestShardRouting) ShardRouting(org.elasticsearch.cluster.routing.ShardRouting) TestShardRouting.newShardRouting(org.elasticsearch.cluster.routing.TestShardRouting.newShardRouting) RecoverySource(org.elasticsearch.cluster.routing.RecoverySource)

Aggregations

RecoverySource (org.elasticsearch.cluster.routing.RecoverySource)1 ShardRouting (org.elasticsearch.cluster.routing.ShardRouting)1 TestShardRouting (org.elasticsearch.cluster.routing.TestShardRouting)1 TestShardRouting.newShardRouting (org.elasticsearch.cluster.routing.TestShardRouting.newShardRouting)1