Skip to content

Commit

Permalink
Merge pull request #190 from ydb-platform/fix_start_partition_session…
Browse files Browse the repository at this point in the history
…_settings_builder

Fix StartPartitionSessionSettings.Builder methods return value, add comments
  • Loading branch information
pnv1 authored Oct 19, 2023
2 parents e07f483 + 45907c2 commit fbefb8f
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,34 @@ public static class Builder {
private Long readOffset;
private Long commitOffset;

public void setReadOffset(Long readOffset) {
/**
* Reads in this partition session will start from offset no less than readOffset.
* If readOffset is set, server will check if that readOffset is not less than the actual committed offset.
* If the check fails then server will send an error message (status != SUCCESS) and close the stream.
* If readOffset is not set or is null (which is default), no check will be made.
*
* InitRequest.max_lag and InitRequest.read_from could lead to skip of more messages.
* Server will return data starting from offset that is maximum of actual committed offset, read_offset (if set)
* and offsets calculated from InitRequest.max_lag and InitRequest.read_from.
*
* @param readOffset Offset to read from. Default: null
* @return Builder
*/
public Builder setReadOffset(Long readOffset) {
this.readOffset = readOffset;
return this;
}

public void setCommitOffset(Long commitOffset) {
/**
* Make server know that all messages with offsets less than commitOffset were fully processed by client.
* Server will commit this position if it is not already done.
*
* @param commitOffset Commit offset, following the offset of last processed (committed) message. Default: null
* @return Builder
*/
public Builder setCommitOffset(Long commitOffset) {
this.commitOffset = commitOffset;
return this;
}

public StartPartitionSessionSettings build() {
Expand Down

0 comments on commit fbefb8f

Please sign in to comment.