Skip to content

Commit bee89f6

Browse files
committed
Fix comments and add api.txt change.
1 parent 2857711 commit bee89f6

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

firebase-firestore/api.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ package com.google.firebase.firestore {
152152
method @NonNull public com.google.firebase.firestore.LoadBundleTask loadBundle(@NonNull java.nio.ByteBuffer);
153153
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> runBatch(@NonNull com.google.firebase.firestore.WriteBatch.Function);
154154
method @NonNull public <TResult> com.google.android.gms.tasks.Task<TResult> runTransaction(@NonNull com.google.firebase.firestore.Transaction.Function<TResult>);
155+
method @NonNull public <TResult> com.google.android.gms.tasks.Task<TResult> runTransaction(@NonNull com.google.firebase.firestore.TransactionOptions, @NonNull com.google.firebase.firestore.Transaction.Function<TResult>);
155156
method public void setFirestoreSettings(@NonNull com.google.firebase.firestore.FirebaseFirestoreSettings);
156157
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> setIndexConfiguration(@NonNull String);
157158
method public static void setLoggingEnabled(boolean);
@@ -387,6 +388,17 @@ package com.google.firebase.firestore {
387388
method @Nullable public TResult apply(@NonNull com.google.firebase.firestore.Transaction) throws com.google.firebase.firestore.FirebaseFirestoreException;
388389
}
389390

391+
public final class TransactionOptions {
392+
method public int getMaxAttempts();
393+
}
394+
395+
public static final class TransactionOptions.Builder {
396+
ctor public TransactionOptions.Builder();
397+
ctor public TransactionOptions.Builder(@NonNull com.google.firebase.firestore.TransactionOptions);
398+
method @NonNull public com.google.firebase.firestore.TransactionOptions build();
399+
method @NonNull public com.google.firebase.firestore.TransactionOptions.Builder setMaxAttempts(int);
400+
}
401+
390402
public class WriteBatch {
391403
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> commit();
392404
method @NonNull public com.google.firebase.firestore.WriteBatch delete(@NonNull com.google.firebase.firestore.DocumentReference);

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,10 @@ public Query collectionGroup(@NonNull String collectionId) {
405405
}
406406

407407
/**
408-
* Executes the given updateFunction and then attempts to commit the changes applied within the
409-
* transaction. If any document read within the transaction has changed, the updateFunction will
410-
* be retried. If it fails to commit after 5 attempts, the transaction will fail.
408+
* Executes the given {@code updateFunction} and then attempts to commit the changes applied
409+
* within the transaction. If any document read within the transaction has changed, the
410+
* updateFunction will be retried. If it fails to commit after 5 attempts, the transaction will
411+
* fail.
411412
*
412413
* <p>The maximum number of writes allowed in a single transaction is 500, but note that each
413414
* usage of {@link FieldValue#serverTimestamp()}, {@link FieldValue#arrayUnion(Object...)}, {@link
@@ -438,9 +439,10 @@ private <ResultT> Task<ResultT> runTransaction(
438439
}
439440

440441
/**
441-
* Executes the given updateFunction and then attempts to commit the changes applied within the
442-
* transaction. If any document read within the transaction has changed, the updateFunction will
443-
* be retried. If it fails to commit after 5 attempts, the transaction will fail.
442+
* Executes the given {@code updateFunction} and then attempts to commit the changes applied
443+
* within the transaction. If any document read within the transaction has changed, the
444+
* updateFunction will be retried. If it fails to commit after 5 attempts, the transaction will
445+
* fail.
444446
*
445447
* @param updateFunction The function to execute within the transaction context.
446448
* @return The task returned from the updateFunction.
@@ -452,12 +454,12 @@ public <TResult> Task<TResult> runTransaction(
452454
}
453455

454456
/**
455-
* Executes the given updateFunction and then attempts to commit the changes applied within the
456-
* transaction. If any document read within the transaction has changed, the updateFunction will
457-
* be retried. If it fails to commit after the maxmimum number of attempts specified in
458-
* transactionOptions, the transaction will fail.
457+
* Executes the given {@code updateFunction} and then attempts to commit the changes applied
458+
* within the transaction. If any document read within the transaction has changed, the
459+
* updateFunction will be retried. If it fails to commit after the maxmimum number of attempts
460+
* specified in transactionOptions, the transaction will fail.
459461
*
460-
* @param options The function to execute within the transaction context.
462+
* @param options The transaction options for controlling execution.
461463
* @param updateFunction The function to execute within the transaction context.
462464
* @return The task returned from the updateFunction.
463465
*/

firebase-firestore/src/main/java/com/google/firebase/firestore/TransactionOptions.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import androidx.annotation.NonNull;
1818

1919
/**
20-
* Parameter for {@link FirebaseFirestore#runTransaction(TransactionOptions, Transaction.Function)}.
20+
* Options to customize transaction behavior for {@link
21+
* FirebaseFirestore#runTransaction(TransactionOptions, Transaction.Function)}.
2122
*/
2223
public final class TransactionOptions {
2324

@@ -46,9 +47,12 @@ public Builder(@NonNull TransactionOptions options) {
4647
}
4748

4849
/**
49-
* Set maximum number of attempts to commit, after which transaction fails. Default is 5.
50+
* Set maximum number of attempts to commit, after which transaction fails.
5051
*
51-
* @return this builder
52+
* <p>The default value is 5. Setting the value to less than 1 will result in an {@link
53+
* IllegalArgumentException}.
54+
*
55+
* @return This builder
5256
*/
5357
@NonNull
5458
public Builder setMaxAttempts(int maxAttempts) {
@@ -60,7 +64,7 @@ public Builder setMaxAttempts(int maxAttempts) {
6064
/**
6165
* Build the {@code TransactionOptions} object.
6266
*
63-
* @return the built {@code TransactionOptions} object
67+
* @return The built {@code TransactionOptions} object
6468
*/
6569
@NonNull
6670
public TransactionOptions build() {
@@ -71,7 +75,7 @@ public TransactionOptions build() {
7175
/**
7276
* Get maximum number of attempts to commit, after which transaction fails. Default is 5.
7377
*
74-
* @return maximum number of attempts
78+
* @return The maximum number of attempts
7579
*/
7680
public int getMaxAttempts() {
7781
return maxAttempts;

0 commit comments

Comments
 (0)