Skip to content

Commit

Permalink
Revert "change service to abstract class"
Browse files Browse the repository at this point in the history
This reverts commit 95b7a9d.

Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Jun 22, 2024
1 parent 95b7a9d commit 84c483a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,12 @@
package org.opensearch.flint.common.metadata.log;

import java.util.Optional;
import org.apache.spark.SparkConf;

/**
* Flint metadata log service provides API for metadata log related operations on a Flint index
* regardless of underlying storage.
*/
public abstract class FlintMetadataLogService {

protected final SparkConf sparkConf;

/**
* Constructor.
*
* @param sparkConf spark configuration
*/
public FlintMetadataLogService(SparkConf sparkConf) {
this.sparkConf = sparkConf;
}

/**
* Default constructor.
*/
public FlintMetadataLogService() {
this(null);
}
public interface FlintMetadataLogService {

/**
* Start a new optimistic transaction.
Expand All @@ -39,15 +20,15 @@ public FlintMetadataLogService() {
* @param forceInit force init transaction and create empty metadata log if not exist
* @return transaction handle
*/
public abstract <T> OptimisticTransaction<T> startTransaction(String indexName, boolean forceInit);
<T> OptimisticTransaction<T> startTransaction(String indexName, boolean forceInit);

/**
* Start a new optimistic transaction.
*
* @param indexName index name
* @return transaction handle
*/
public <T> OptimisticTransaction<T> startTransaction(String indexName) {
default <T> OptimisticTransaction<T> startTransaction(String indexName) {
return startTransaction(indexName, false);
}

Expand All @@ -57,12 +38,12 @@ public <T> OptimisticTransaction<T> startTransaction(String indexName) {
* @param indexName index name
* @return optional metadata log
*/
public abstract Optional<FlintMetadataLog<FlintMetadataLogEntry>> getIndexMetadataLog(String indexName);
Optional<FlintMetadataLog<FlintMetadataLogEntry>> getIndexMetadataLog(String indexName);

/**
* Record heartbeat timestamp for index streaming job.
*
* @param indexName index name
*/
public abstract void recordHeartbeat(String indexName);
void recordHeartbeat(String indexName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Flint metadata log service implementation for OpenSearch storage.
*/
public class FlintOpenSearchMetadataLogService extends FlintMetadataLogService {
public class FlintOpenSearchMetadataLogService implements FlintMetadataLogService {

private static final Logger LOG = Logger.getLogger(FlintOpenSearchMetadataLogService.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ class FlintMetadataLogITSuite extends OpenSearchTransactionSuite with Matchers {
}
}

case class TestMetadataLogService(sparkConfParam: SparkConf)
extends FlintMetadataLogService(sparkConfParam) {
case class TestMetadataLogService(sparkConf: SparkConf) extends FlintMetadataLogService {
override def startTransaction[T](
indexName: String,
forceInit: Boolean): OptimisticTransaction[T] = {
Expand Down

0 comments on commit 84c483a

Please sign in to comment.