Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spanner: Added extra documentation to the DatabaseClient.singleUse methods #4721

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public interface DatabaseClient {

/**
* Returns a context in which a single read can be performed using {@link TimestampBound#strong()}
* concurrency.
* concurrency. This method will return a {@link ReadContext} that will not return the read
* timestamp that was used by Cloud Spanner. If you want to be able to access the read timestamp,
* you should use the method {@link #singleUseReadOnlyTransaction()}.
*
* <p>Example of single use.
*
Expand All @@ -100,17 +102,18 @@ public interface DatabaseClient {
ReadContext singleUse();

/**
* Returns a context in which a single read can be performed at the given timestamp bound.
* Returns a context in which a single read can be performed at the given timestamp bound. This
* method will return a {@link ReadContext} that will not return the read timestamp that was used
* by Cloud Spanner. If you want to be able to access the read timestamp, you should use the
* method {@link #singleUseReadOnlyTransaction()}.
*
* <p>Example of single use with timestamp bound.
*
* <pre>{@code
* long singerId = my_singer_id;
* String column = "FirstName";
* Struct row =
* dbClient
* .singleUse(TimestampBound.ofMaxStaleness(10, TimeUnit.SECONDS))
* .readRow("Singers", Key.of(singerId), Collections.singleton(column));
* Struct row = dbClient.singleUse(TimestampBound.ofMaxStaleness(10, TimeUnit.SECONDS))
* .readRow("Singers", Key.of(singerId), Collections.singleton(column));
* String firstName = row.getString(column);
* }</pre>
*
Expand Down