Skip to content

Commit

Permalink
PR feedback: More explicit javadocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Griffin committed Oct 10, 2024
1 parent 7be807f commit 4dbd431
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/com/fauna/stream/StreamRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ public Builder startTs(Long startTs) {
/**
* Return the current builder instance with the given timeout.
* This timeout is the HTTP client timeout that is passed to java.net.http.HttpRequest.Builder.
* By testing, it seems that the client waits for the first byte, not the last byte of the response.
* Therefore, it's a timeout on the stream being opened, but the stream can stay open indefinitely.
* The Java documentation says that if "the response is not received within the specified timeout then an
* HttpTimeoutException is thrown". For streaming this means that the exception is thrown if the first
* headers/bytes are not recieved within the timeout.
*
* The default value is null if the user does not set this timeout.
* @param timeout A Duration representing the timeout.
* @return The current Builder instance.
*/
Expand Down Expand Up @@ -105,14 +108,29 @@ public String getToken() {
return token;
}

/**
* Cursor for a previous event. If provided, the stream replays any events that occurred after
* the cursor (exclusive).
* @return The cursor, or Optional.empty() if not provided.
*/
public Optional<String> getCursor() {
return Optional.ofNullable(cursor);
}

/**
* Stream start time in microseconds since the Unix epoch. This is typically a previous event's txn_ts
* (transaction timestamp).
* @return The stream start time, as a Long, or Optional.empty() if not provided.
*/
public Optional<Long> getStartTs() {
return Optional.ofNullable(startTs);
}

/**
* Stream HTTP request timeout. This timeout is passed to java.net.http.HttpRequest.Builder. The default
* is null/empty.
* @return The timeout Duration, or Optional.empty() if not set.
*/
public Optional<Duration> getTimeout() {
return Optional.ofNullable(timeout);
}
Expand Down

0 comments on commit 4dbd431

Please sign in to comment.