diff --git a/flint-commons/src/main/scala/org/opensearch/flint/common/metadata/log/FlintMetadataLogService.java b/flint-commons/src/main/scala/org/opensearch/flint/common/metadata/log/FlintMetadataLogService.java index 0e525aaf8..4cb1305d2 100644 --- a/flint-commons/src/main/scala/org/opensearch/flint/common/metadata/log/FlintMetadataLogService.java +++ b/flint-commons/src/main/scala/org/opensearch/flint/common/metadata/log/FlintMetadataLogService.java @@ -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. @@ -39,7 +20,7 @@ public FlintMetadataLogService() { * @param forceInit force init transaction and create empty metadata log if not exist * @return transaction handle */ - public abstract OptimisticTransaction startTransaction(String indexName, boolean forceInit); + OptimisticTransaction startTransaction(String indexName, boolean forceInit); /** * Start a new optimistic transaction. @@ -47,7 +28,7 @@ public FlintMetadataLogService() { * @param indexName index name * @return transaction handle */ - public OptimisticTransaction startTransaction(String indexName) { + default OptimisticTransaction startTransaction(String indexName) { return startTransaction(indexName, false); } @@ -57,12 +38,12 @@ public OptimisticTransaction startTransaction(String indexName) { * @param indexName index name * @return optional metadata log */ - public abstract Optional> getIndexMetadataLog(String indexName); + Optional> getIndexMetadataLog(String indexName); /** * Record heartbeat timestamp for index streaming job. * * @param indexName index name */ - public abstract void recordHeartbeat(String indexName); + void recordHeartbeat(String indexName); } diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java index 18be8efbf..bd456d875 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java +++ b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java @@ -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()); diff --git a/integ-test/src/test/scala/org/opensearch/flint/core/FlintMetadataLogITSuite.scala b/integ-test/src/test/scala/org/opensearch/flint/core/FlintMetadataLogITSuite.scala index 968244734..877b5ce79 100644 --- a/integ-test/src/test/scala/org/opensearch/flint/core/FlintMetadataLogITSuite.scala +++ b/integ-test/src/test/scala/org/opensearch/flint/core/FlintMetadataLogITSuite.scala @@ -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] = {