Skip to content

Commit 75acf3d

Browse files
feature/#45 Extend a method query(String entryName, QueryOptions options) for Bucket class. Add a QueryOptions class for the new method
1 parent 1ca00ff commit 75acf3d

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Add exists option to BucketSettings. [PR-42](https://github.com/reductstore/reduct-java/issues/42)
3333
- Bucket.writeRecord receives entry name and bucket. [PR-43](https://github.com/reductstore/reduct-java/issues/43)
3434
- Add getBucket method to ReductClient. [PR-44](https://github.com/reductstore/reduct-java/issues/44)
35+
- Extend a method query(String entryName, QueryOptions options) for Bucket class. Add a QueryOptions class for the new method [PR-45](https://github.com/reductstore/reduct-java/issues/45)
3536
### Infrastructure:
3637

3738
- Added GitHub Actions for CI/CD [PR-35](https://github.com/reductstore/reduct-java/pull/35)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package store.reduct.model;
2+
3+
import lombok.Builder;
4+
import lombok.Data;
5+
6+
@Builder
7+
@Data
8+
public class QueryOptions {
9+
private final Long start;
10+
private final Long stop;
11+
private final Long ttl;
12+
}

src/main/java/store/reduct/model/bucket/Bucket.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import store.reduct.common.BucketURL;
1919
import store.reduct.common.RecordURL;
2020
import store.reduct.common.exception.ReductException;
21+
import store.reduct.model.QueryOptions;
2122
import store.reduct.model.mapper.BucketMapper;
2223
import store.reduct.model.record.QueryId;
2324
import store.reduct.model.record.Record;
@@ -288,6 +289,18 @@ public Iterator<Record> query(String entryName, Long start, Long stop, Long ttl)
288289
return new RecordIterator(name, entryName, queryId.getId(), reductClient.getServerProperties().url());
289290
}
290291

292+
/**
293+
* Query records for a time interval
294+
*
295+
* @param entryName
296+
* @param options
297+
* @return
298+
*/
299+
public Iterator<Record> query(String entryName, QueryOptions options)
300+
throws ReductException, IllegalArgumentException {
301+
return query(entryName, options.getStart(), options.getStop(), options.getTtl());
302+
}
303+
291304
public Iterator<Record> getMetaInfos(String entryName, Long start, Long stop, Long ttl)
292305
throws ReductException, IllegalArgumentException {
293306
if (Strings.isBlank(name) || Strings.isBlank(entryName) || Objects.isNull(start) || Objects.isNull(stop)

0 commit comments

Comments
 (0)