forked from opensearch-project/opensearch-spark
-
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.
Extract metadata log operations from FlintClient into FlintMetadataLo…
…gService (opensearch-project#379) * metadata log service interface Signed-off-by: Sean Kao <[email protected]> * flint opensearch metadata log service impl Signed-off-by: Sean Kao <[email protected]> * reflection for metadata log service instantiate Signed-off-by: Sean Kao <[email protected]> * add comments Signed-off-by: Sean Kao <[email protected]> * undo using client builder in tests FlintClientBuilder uses reflection to instantiate FlintMetadataLogService, which cannot be checked at compile time. Signed-off-by: Sean Kao <[email protected]> * use metadata log service in transaction IT suites Signed-off-by: Sean Kao <[email protected]> * metadata log test suite Signed-off-by: Sean Kao <[email protected]> * flint client builder test Signed-off-by: Sean Kao <[email protected]> * scalafmtAll Signed-off-by: Sean Kao <[email protected]> * undo reflection Signed-off-by: Sean Kao <[email protected]> * rename descriptive symbols Signed-off-by: Sean Kao <[email protected]> * descriptive parameter name and update comment Signed-off-by: Sean Kao <[email protected]> * remove init from getMetadataLog interface Signed-off-by: Sean Kao <[email protected]> * remove startTransaction from FlintClient Signed-off-by: Sean Kao <[email protected]> * rm flint os client dep on metadata log service Signed-off-by: Sean Kao <[email protected]> * rename function and remove unused flint client Signed-off-by: Sean Kao <[email protected]> * remove test case for init in getMetadataLog Signed-off-by: Sean Kao <[email protected]> * abstract recordHeartbeat method Signed-off-by: Sean Kao <[email protected]> * consistent var naming for metadataLogIndexName Signed-off-by: Sean Kao <[email protected]> --------- Signed-off-by: Sean Kao <[email protected]>
- Loading branch information
1 parent
80d8f6e
commit d0caa7b
Showing
12 changed files
with
372 additions
and
208 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
49 changes: 49 additions & 0 deletions
49
...t-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.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,49 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.core.metadata.log; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Flint metadata log service provides API for metadata log related operations on a Flint index | ||
* regardless of underlying storage. | ||
*/ | ||
public interface FlintMetadataLogService { | ||
|
||
/** | ||
* Start a new optimistic transaction. | ||
* | ||
* @param indexName index name | ||
* @param forceInit force init transaction and create empty metadata log if not exist | ||
* @return transaction handle | ||
*/ | ||
<T> OptimisticTransaction<T> startTransaction(String indexName, boolean forceInit); | ||
|
||
/** | ||
* Start a new optimistic transaction. | ||
* | ||
* @param indexName index name | ||
* @return transaction handle | ||
*/ | ||
default <T> OptimisticTransaction<T> startTransaction(String indexName) { | ||
return startTransaction(indexName, false); | ||
} | ||
|
||
/** | ||
* Get metadata log for index. | ||
* | ||
* @param indexName index name | ||
* @return optional metadata log | ||
*/ | ||
Optional<FlintMetadataLog<FlintMetadataLogEntry>> getIndexMetadataLog(String indexName); | ||
|
||
/** | ||
* Record heartbeat timestamp for index streaming job. | ||
* | ||
* @param indexName index name | ||
*/ | ||
void recordHeartbeat(String indexName); | ||
} |
18 changes: 18 additions & 0 deletions
18
...src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogServiceBuilder.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,18 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.core.metadata.log; | ||
|
||
import org.opensearch.flint.core.FlintOptions; | ||
import org.opensearch.flint.core.storage.FlintOpenSearchMetadataLogService; | ||
|
||
/** | ||
* {@link FlintMetadataLogService} builder. | ||
*/ | ||
public class FlintMetadataLogServiceBuilder { | ||
public static FlintMetadataLogService build(FlintOptions options) { | ||
return new FlintOpenSearchMetadataLogService(options); | ||
} | ||
} |
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.