-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RecoverySourceHandlerFactory for extensibility
Signed-off-by: Ashish Singh <[email protected]>
- Loading branch information
Showing
7 changed files
with
105 additions
and
23 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
server/src/main/java/org/opensearch/indices/recovery/DefaultRecoverySourceHandler.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,27 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.recovery; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
public class DefaultRecoverySourceHandler extends RecoverySourceHandler { | ||
|
||
public DefaultRecoverySourceHandler( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
ThreadPool threadPool, | ||
StartRecoveryRequest request, | ||
int fileChunkSizeInBytes, | ||
int maxConcurrentFileChunks, | ||
int maxConcurrentOperations | ||
) { | ||
super(shard, recoveryTarget, threadPool, request, fileChunkSizeInBytes, maxConcurrentFileChunks, maxConcurrentOperations); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandlerFactory.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,31 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.recovery; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
|
||
public class RecoverySourceHandlerFactory { | ||
|
||
public RecoverySourceHandler create( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
StartRecoveryRequest request, | ||
RecoverySettings recoverySettings | ||
) { | ||
return new DefaultRecoverySourceHandler( | ||
shard, | ||
recoveryTarget, | ||
shard.getThreadPool(), | ||
request, | ||
Math.toIntExact(recoverySettings.getChunkSize().getBytes()), | ||
recoverySettings.getMaxConcurrentFileChunks(), | ||
recoverySettings.getMaxConcurrentOperations() | ||
); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...c/main/java/org/opensearch/indices/recovery/remotestore/ReplicaRecoverySourceHandler.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,29 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.recovery.remotestore; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
import org.opensearch.indices.recovery.RecoverySourceHandler; | ||
import org.opensearch.indices.recovery.RecoveryTargetHandler; | ||
import org.opensearch.indices.recovery.StartRecoveryRequest; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
public class ReplicaRecoverySourceHandler extends RecoverySourceHandler { | ||
public ReplicaRecoverySourceHandler( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
ThreadPool threadPool, | ||
StartRecoveryRequest request, | ||
int fileChunkSizeInBytes, | ||
int maxConcurrentFileChunks, | ||
int maxConcurrentOperations | ||
) { | ||
super(shard, recoveryTarget, threadPool, request, fileChunkSizeInBytes, maxConcurrentFileChunks, maxConcurrentOperations); | ||
} | ||
} |
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