public final class TransactionOptions extends Object
A transaction in Firestore can be either read-write or read-only.
The default set of options is a read-write transaction with a maximum number of 5 attempts.
This attempt count can be customized via the TransactionOptions.ReadWriteOptionsBuilder.setNumberOfAttempts(int) method. A new instance of a builder can be
created by calling createReadWriteOptionsBuilder().
A read-only transaction can be configured via the TransactionOptions.ReadOnlyOptionsBuilder class. A new
instance can be created by calling createReadOnlyOptionsBuilder().
TransactionOptions| Modifier and Type | Class and Description |
|---|---|
static class |
TransactionOptions.Builder<B extends TransactionOptions.Builder<B>> |
static class |
TransactionOptions.ReadOnlyOptionsBuilder
A typesafe builder class representing those options that are applicable when configuring a
transaction to be read-only.
|
static class |
TransactionOptions.ReadWriteOptionsBuilder
A typesafe builder class representing those options that are applicable when configuring a
transaction to be read-write.
|
static class |
TransactionOptions.TransactionOptionsType |
public int getNumberOfAttempts()
@Nullable public Executor getExecutor()
@Nonnull public TransactionOptions.TransactionOptionsType getType()
@Nullable public com.google.protobuf.Timestamp getReadTime()
Timestamp specifying the time documents are to be read at. If null, the server will
read documents at the most up to date available. If non-null, the specified Timestamp
may not be more than 60 seconds in the past (evaluated when the request is processed by the
server).@Nonnull public static TransactionOptions create()
createReadWriteOptionsBuilder()@Nonnull @Deprecated public static TransactionOptions create(int numberOfAttempts)
TransactionOptions.ReadWriteOptionsBuilder.setNumberOfAttempts(int)numberOfAttempts - The number of execution attempts.createReadWriteOptionsBuilder()@Nonnull @Deprecated public static TransactionOptions create(@Nullable Executor executor)
TransactionOptions.Builder.setExecutor(Executor)executor - The executor to run the user callback code on.createReadWriteOptionsBuilder()@Nonnull @Deprecated public static TransactionOptions create(@Nullable Executor executor, int numberOfAttempts)
TransactionOptions.Builder.setExecutor(Executor) and
TransactionOptions.ReadWriteOptionsBuilder.setNumberOfAttempts(int)executor - The executor to run the user callback code on.numberOfAttempts - The number of execution attempts.createReadWriteOptionsBuilder()@Nonnull public static TransactionOptions.ReadWriteOptionsBuilder createReadWriteOptionsBuilder()
@Nonnull public static TransactionOptions.ReadOnlyOptionsBuilder createReadOnlyOptionsBuilder()
Copyright © 2022 Google LLC. All rights reserved.