Skip to content

Commit

Permalink
feat(store): introduce the high level StreamStore for store module (#35)
Browse files Browse the repository at this point in the history
Signed-off-by: daniel-y <daniel@automq.com>
  • Loading branch information
daniel-y authored Sep 16, 2023
1 parent 64756cb commit 02c3345
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.automq.rocketmq</groupId>
<artifactId>rocketmq-s3stream</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<artifactId>flatbuffers-java</artifactId>
<version>23.5.26</version>
</dependency>
<dependency>
<groupId>com.automq.rocketmq</groupId>
<artifactId>rocketmq-s3stream</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
27 changes: 24 additions & 3 deletions store/src/main/java/com/automq/rocketmq/store/StreamStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<FetchResult> 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<AppendResult> append(long streamId, RecordBatch recordBatch);
}

This file was deleted.

0 comments on commit 02c3345

Please sign in to comment.