Skip to content

Commit

Permalink
Make more backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-andersen committed Feb 10, 2024
1 parent 724eb17 commit 3bb84b8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ final class ReadTimeTransaction extends Transaction {
this.readTime = readTime;
}

@Override
public boolean hasTransactionId() {
return false;
}

@Nonnull
@Override
public ApiFuture<DocumentSnapshot> get(@Nonnull DocumentReference documentRef) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ ApiFuture<Void> rollback() {
MoreExecutors.directExecutor());
}

@Override
public boolean hasTransactionId() {
return true;
}

/**
* Reads the document referred to by the provided DocumentReference. Holds a pessimistic lock on
* the returned document.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* <p>TransactionRunner uses exponential backoff to increase the chance that retries succeed. To
* customize the backoff settings, you can specify custom settings via {@link FirestoreOptions}.
*/
class ServerSideTransactionRunner<T> {
final class ServerSideTransactionRunner<T> {

private static final Tracer tracer = Tracing.getTracer();
private static final io.opencensus.trace.Status TOO_MANY_RETRIES_STATUS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ protected String className() {
return "Transaction";
}

public abstract boolean hasTransactionId();

@Override
Transaction wrapResult(int writeIndex) {
return this;
Expand Down

0 comments on commit 3bb84b8

Please sign in to comment.