Skip to content

Commit

Permalink
Spanner: Added extra documentation to the DatabaseClient.singleUse me…
Browse files Browse the repository at this point in the history
…thods (#4721)

* added extra documentation to the singleUse methods #4212

* changed formatting manually and re-run mvn formatter
  • Loading branch information
olavloite authored and kolea2 committed Mar 26, 2019
1 parent 249d163 commit 620d105
Showing 1 changed file with 9 additions and 6 deletions.
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

0 comments on commit 620d105

Please sign in to comment.