forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce TranslogFactory for Local/Remote Translog support (opensear…
…ch-project#4172) * Introduce TranslogFactory for Local/Remote Translog support Signed-off-by: Bukhtawar Khan <[email protected]>
- Loading branch information
Showing
17 changed files
with
164 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
server/src/main/java/org/opensearch/index/translog/InternalTranslogFactory.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,41 @@ | ||
/* | ||
* 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.index.translog; | ||
|
||
import java.io.IOException; | ||
import java.util.function.LongConsumer; | ||
import java.util.function.LongSupplier; | ||
|
||
/** | ||
* Translog Factory for the local on-disk {@link Translog} | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class InternalTranslogFactory implements TranslogFactory { | ||
|
||
@Override | ||
public Translog newTranslog( | ||
TranslogConfig translogConfig, | ||
String translogUUID, | ||
TranslogDeletionPolicy translogDeletionPolicy, | ||
LongSupplier globalCheckpointSupplier, | ||
LongSupplier primaryTermSupplier, | ||
LongConsumer persistedSequenceNumberConsumer | ||
) throws IOException { | ||
|
||
return new Translog( | ||
translogConfig, | ||
translogUUID, | ||
translogDeletionPolicy, | ||
globalCheckpointSupplier, | ||
primaryTermSupplier, | ||
persistedSequenceNumberConsumer | ||
); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
server/src/main/java/org/opensearch/index/translog/TranslogFactory.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,32 @@ | ||
/* | ||
* 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.index.translog; | ||
|
||
import java.io.IOException; | ||
import java.util.function.LongConsumer; | ||
import java.util.function.LongSupplier; | ||
|
||
/** | ||
* Translog Factory to enable creation of various local on-disk | ||
* and remote store flavors of {@link Translog} | ||
* | ||
* @opensearch.internal | ||
*/ | ||
@FunctionalInterface | ||
public interface TranslogFactory { | ||
|
||
Translog newTranslog( | ||
final TranslogConfig config, | ||
final String translogUUID, | ||
final TranslogDeletionPolicy deletionPolicy, | ||
final LongSupplier globalCheckpointSupplier, | ||
final LongSupplier primaryTermSupplier, | ||
final LongConsumer persistedSequenceNumberConsumer | ||
) throws IOException; | ||
} |
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
Oops, something went wrong.