diff --git a/pom.xml b/pom.xml index 5b3963ae7..c0a7e9996 100644 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,11 @@ + + com.automq.rocketmq + rocketmq-s3stream + ${project.version} + io.grpc grpc-bom diff --git a/store/pom.xml b/store/pom.xml index 36ed2dfca..518129d18 100644 --- a/store/pom.xml +++ b/store/pom.xml @@ -54,6 +54,10 @@ flatbuffers-java 23.5.26 + + com.automq.rocketmq + rocketmq-s3stream + diff --git a/store/src/main/java/com/automq/rocketmq/store/StreamStore.java b/store/src/main/java/com/automq/rocketmq/store/StreamStore.java index 85e1dc6b3..93d8166df 100644 --- a/store/src/main/java/com/automq/rocketmq/store/StreamStore.java +++ b/store/src/main/java/com/automq/rocketmq/store/StreamStore.java @@ -17,9 +17,30 @@ package com.automq.rocketmq.store; -import com.automq.rocketmq.store.model.stream.FetchResult; -import java.util.UUID; +import com.automq.rocketmq.stream.api.AppendResult; +import com.automq.rocketmq.stream.api.FetchResult; +import com.automq.rocketmq.stream.api.RecordBatch; +import java.util.concurrent.CompletableFuture; +/** + * A high level abstraction of stream store, hidden the details of S3Stream module. + */ public interface StreamStore { - FetchResult fetch(UUID topicId, int queueId, long offset, int maxCount); + /** + * Fetch records from stream store. + * + * @param streamId the target stream id. + * @param startOffset the start offset of the fetch. + * @param maxCount the max return count of the fetch. + * @return the future of fetch result. + */ + CompletableFuture fetch(long streamId, long startOffset, int maxCount); + + /** + * Append record batch to stream store. + * @param streamId the target stream id. + * @param recordBatch the record batch to append. + * @return the future of append result. + */ + CompletableFuture append(long streamId, RecordBatch recordBatch); } diff --git a/store/src/main/java/com/automq/rocketmq/store/model/stream/FetchResult.java b/store/src/main/java/com/automq/rocketmq/store/model/stream/FetchResult.java deleted file mode 100644 index 0e0ccf47e..000000000 --- a/store/src/main/java/com/automq/rocketmq/store/model/stream/FetchResult.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.automq.rocketmq.store.model.stream; - -import com.automq.rocketmq.common.model.Message; -import java.util.List; - -public record FetchResult(int status, List messageList) { -}