FdbTransactionOptionsExtensions
Namespace: FoundationDB.Client · class
Extension methods for IFdbTransactionOptions
Methods
WithAuthorizationToken
static IFdbTransactionOptions WithAuthorizationToken(IFdbTransactionOptions options, ReadOnlySpan<char> token)
Attach given authorization token to the transaction such that subsequent tenant-aware requests are authorized.
options— Transaction that will be configured for the current attempt.token— A JSON Web Token authorized to access data belonging to one or more tenants, indicated by 'tenants' claim of the token's payload.
Attach given authorization token to the transaction such that subsequent tenant-aware requests are authorized
WithAutoThrottleTag
static IFdbTransactionOptions WithAutoThrottleTag(IFdbTransactionOptions options, string tag)
Adds a tag to the transaction that can be used to apply manual or automatic targeted throttling.
options— Transaction that will be configured for the current attempt.tag— String identifier used to associate this transaction with a throttling group. Must not exceed 16 characters.
See Tag
At most 5 tags can be set on a transaction.
static IFdbTransactionOptions WithAutoThrottleTag(IFdbTransactionOptions options, ReadOnlySpan<char> tag)
Adds a tag to the transaction that can be used to apply manual or automatic targeted throttling.
options— Transaction that will be configured for the current attempt.tag— String identifier used to associate this transaction with a throttling group. Must not exceed 16 characters.
See Tag
At most 5 tags can be set on a transaction.
WithAutomaticIdempotency
static IFdbTransactionOptions WithAutomaticIdempotency(IFdbTransactionOptions options)
Automatically assign a random 16 byte idempotency id for this transaction.
options— Transaction that will be configured for the current attempt.
See AutomaticIdempotency.
Prevents commits from failing with CommitUnknownResult.
WARNING: If you are also using the multiversion client or transaction timeouts, if either cluster_version_changed or transaction_timed_out was thrown during a commit, then that commit may have already succeeded or may succeed in the future.
This feature is in development and not ready for general use.
WithBypassStorageQuota
static IFdbTransactionOptions WithBypassStorageQuota(IFdbTransactionOptions options)
Allows this transaction to bypass storage quota enforcement.
options— Transaction that will be configured for the current attempt.
See
WithBypassUnreadable
static IFdbTransactionOptions WithBypassUnreadable(IFdbTransactionOptions options)
Allows get operations to read from sections of keyspace that have become unreadable because of VersionStamp operations.
options— Transaction that will be configured for the current attempt.
See BypassUnreadable.
These reads will view VersionStamp operations as if they were set operations that did not fill in the VersionStamp.
WithDebugTransactionIdentifier
static IFdbTransactionOptions WithDebugTransactionIdentifier(IFdbTransactionOptions options, string id)
Sets an identifier for server tracing of this transaction.
options— Transaction that will be configured for the current attempt.id— String identifier to be used when tracing or profiling this transaction. The identifier must not exceed 100 characters.
See
static IFdbTransactionOptions WithDebugTransactionIdentifier(IFdbTransactionOptions options, ReadOnlySpan<char> id)
Sets an identifier for server tracing of this transaction.
options— Transaction that will be configured for the current attempt.id— String identifier to be used when tracing or profiling this transaction. The identifier must not exceed 100 characters.
See
WithFirstInBatch
static IFdbTransactionOptions WithFirstInBatch(IFdbTransactionOptions options)
No other transactions will be applied before this transaction within the same commit version.
options— Transaction that will be configured for the current attempt.
WithIdempotencyId
static IFdbTransactionOptions WithIdempotencyId(IFdbTransactionOptions options, string id)
Associate this transaction with this ID for the purpose of checking whether this transaction has already committed.
options— Transaction that will be configured for the current attempt.id— Unique ID. Must be at least 16 bytes and less than 256 bytes.
Requires API level 720 or greater. See
static IFdbTransactionOptions WithIdempotencyId(IFdbTransactionOptions options, ReadOnlySpan<char> id)
Associate this transaction with this ID for the purpose of checking whether this transaction has already committed.
options— Transaction that will be configured for the current attempt.id— Unique ID. Must be at least 16 bytes and less than 256 bytes.
Requires API level 720 or greater. See .
WithLockAware
static IFdbTransactionOptions WithLockAware(IFdbTransactionOptions options)
The transaction can read and write to locked databases, and is responsible for checking that it took the lock.
options— Transaction that will be configured for the current attempt.
WithMaxRetryDelay
static IFdbTransactionOptions WithMaxRetryDelay(IFdbTransactionOptions options, int milliseconds)
Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable. Defaults to 1000 ms. Valid parameter values are [0, int.MaxValue]. If the maximum retry delay is less than the current retry delay of the transaction, then the current retry delay will be clamped to the maximum retry delay.
options— Transaction that will be configured for the current attempt.milliseconds— Maximum retry delay (in milliseconds)
static IFdbTransactionOptions WithMaxRetryDelay(IFdbTransactionOptions options, TimeSpan delay)
Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable.
options— Transaction that will be configured for the current attempt.delay— Maximum retry delay (rounded up to milliseconds)
Defaults to 1000 ms. Valid parameter values are [TimeSpan.Zero, TimeSpan.MaxValue].
If the maximum retry delay is less than the current retry delay of the transaction, then the current retry delay will be clamped to the maximum retry delay.
WithNextWriteNoWriteConflictRange
static IFdbTransactionOptions WithNextWriteNoWriteConflictRange(IFdbTransactionOptions options)
The next write performed on this transaction will not generate a write conflict range. As a result, other transactions which read the key(s) being modified by the next write will not conflict with this transaction. Care needs to be taken when using this option on a transaction that is shared between multiple threads. When setting this option, write conflict ranges will be disabled on the next write operation, regardless of what thread it is on.
See
WithPriorityBatch
static IFdbTransactionOptions WithPriorityBatch(IFdbTransactionOptions options)
Specifies that this transaction should be treated as low priority and that default priority transactions should be processed first. Useful for doing batch work simultaneously with latency-sensitive work
See
WithPrioritySystemImmediate
static IFdbTransactionOptions WithPrioritySystemImmediate(IFdbTransactionOptions options)
Specifies that this transaction should be treated as highest priority and that lower priority transactions should block behind this one. Use is discouraged outside low-level tools
See
WithRawAccess
static IFdbTransactionOptions WithRawAccess(IFdbTransactionOptions options)
Allows this transaction to access the raw key-space when tenant mode is on.
options— Transaction that will be configured for the current attempt.
See
WithReadAccessToSystemKeys
static IFdbTransactionOptions WithReadAccessToSystemKeys(IFdbTransactionOptions options)
Allows this transaction to read system keys (those that start with the byte 0xFF)
See
WithReadLockAware
static IFdbTransactionOptions WithReadLockAware(IFdbTransactionOptions options)
The transaction can read from locked databases.
options— Transaction that will be configured for the current attempt.
WithReadPriorityHigh
static IFdbTransactionOptions WithReadPriorityHigh(IFdbTransactionOptions options)
Use high read priority for subsequent read requests in this transaction.
See
WithReadPriorityLow
static IFdbTransactionOptions WithReadPriorityLow(IFdbTransactionOptions options)
Use low read priority for subsequent read requests in this transaction.
See
WithReadPriorityNormal
static IFdbTransactionOptions WithReadPriorityNormal(IFdbTransactionOptions options)
Use normal read priority for subsequent read requests in this transaction.
See
WithReadYourWritesDisable
static IFdbTransactionOptions WithReadYourWritesDisable(IFdbTransactionOptions options)
Reads performed by a transaction will not see any prior mutations that occurred in that transaction, instead seeing the value which was in the database at the transaction's read version. This option may provide a small performance benefit for the client, but also disables a number of client-side optimizations which are beneficial for transactions which tend to read and write the same keys within a single transaction. Also note that with this option invoked any outstanding reads will return errors when transaction commit is called (rather than the normal behavior of commit waiting for outstanding reads to complete).
See
WithReportConflictingKeys
static IFdbTransactionOptions WithReportConflictingKeys(IFdbTransactionOptions options)
The transaction can retrieve keys that are conflicting with other transactions.
options— Transaction that will be configured for the current attempt.
When CommitAsync fails with error NotCommitted (1020), you can retrieve the conflicting keys by performing a read range under the special key `\xFF\xFF/transaction/conflicting_keys/`
WithRetryLimit
static IFdbTransactionOptions WithRetryLimit(IFdbTransactionOptions options, int retries)
Set a maximum number of retries after which additional calls to onError will throw the most recently seen error code.
options— Transaction that will be configured for the current attempt.retries— Number of times to retry. If set to -1, will disable the retry limit.
WithServerRequestTracing
static IFdbTransactionOptions WithServerRequestTracing(IFdbTransactionOptions options)
Sets an identifier for server tracing of this transaction.
options— Transaction that will be configured for the current attempt.
See
WithSizeLimit
static IFdbTransactionOptions WithSizeLimit(IFdbTransactionOptions options, int limit)
Set the transaction size limit in bytes.
options— Transaction that will be configured for the current attempt.limit— Value in bytes. This value must be at least 32 and cannot be set to higher than 10,000,000, the default transaction size limit.
The size is calculated by combining the sizes of all keys and values written or mutated, all key ranges cleared, and all read and write conflict ranges. (In other words, it includes the total size of all data included in the request to the cluster to commit the transaction.) Large transactions can cause performance problems on FoundationDB clusters, so setting this limit to a smaller value than the default can help prevent the client from accidentally degrading the cluster's performance.
WithSnapshotReadYourWritesDisable
static IFdbTransactionOptions WithSnapshotReadYourWritesDisable(IFdbTransactionOptions options)
Reads performed by a transaction will not see the results of writes done in the same transaction.
See
WithSnapshotReadYourWritesEnable
static IFdbTransactionOptions WithSnapshotReadYourWritesEnable(IFdbTransactionOptions options)
Snapshot reads performed by a transaction will see the results of writes done in the same transaction.
See
WithSpanParent
static IFdbTransactionOptions WithSpanParent(IFdbTransactionOptions options, Slice id)
Adds a parent to the Span of this transaction.
options— Transaction that will be configured for the current attempt.id— A span can be identified with any 16 bytes.
See SpanParent
Used for transaction tracing.
static IFdbTransactionOptions WithSpanParent(IFdbTransactionOptions options, ReadOnlySpan<byte> id)
Adds a parent to the Span of this transaction.
options— Transaction that will be configured for the current attempt.id— A span can be identified with any 16 bytes.
See SpanParent
Used for transaction tracing.
WithSpecialKeySpaceEnableWrites
static IFdbTransactionOptions WithSpecialKeySpaceEnableWrites(IFdbTransactionOptions options)
By default, users are not allowed to write to special keys.
options— Transaction that will be configured for the current attempt.
See SpecialKeySpaceEnableWrites.
Enabling this option will implicitly enable all options required to achieve the configuration change.
WithSpecialKeySpaceRelaxed
static IFdbTransactionOptions WithSpecialKeySpaceRelaxed(IFdbTransactionOptions options)
Allow reading from zero or more modules.
options— Transaction that will be configured for the current attempt.
By default, the special key space will only allow users to read from exactly one module (a subspace in the special key space). Use this option to allow reading from zero or more modules.
Users who set this option should be prepared for new modules, which may have different behaviors than the modules they're currently reading. For example, a new module might block or return an error.
WithTag
static IFdbTransactionOptions WithTag(IFdbTransactionOptions options, string tag)
Associate this transaction with this ID for the purpose of checking whether this transaction has already committed.
options— Transaction that will be configured for the current attempt.tag— String identifier used to associate this transaction with a throttling group. Must not exceed 16 characters.
See Tag
At most 5 tags can be set on a transaction.
static IFdbTransactionOptions WithTag(IFdbTransactionOptions options, ReadOnlySpan<char> tag)
Associate this transaction with this ID for the purpose of checking whether this transaction has already committed.
options— Transaction that will be configured for the current attempt.tag— String identifier used to associate this transaction with a throttling group. Must not exceed 16 characters.
See Tag
At most 5 tags can be set on a transaction.
WithTimeout
static IFdbTransactionOptions WithTimeout(IFdbTransactionOptions options, TimeSpan timeout)
Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled. Valid parameter values are [TimeSpan.Zero, TimeSpan.MaxValue]. If set to 0, will disable all timeouts. All pending and any future uses of the transaction will throw an exception. The transaction can be used again after it is reset.
options— Transaction to use for the operationtimeout— Timeout (rounded up to milliseconds), or TimeSpan.Zero for infinite timeout
static IFdbTransactionOptions WithTimeout(IFdbTransactionOptions options, int milliseconds)
Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled. Valid parameter values are [0, int.MaxValue]. If set to 0, will disable all timeouts. All pending and any future uses of the transaction will throw an exception. The transaction can be used again after it is reset.
options— Transaction to use for the operationmilliseconds— Timeout in millisecond, or 0 for infinite timeout
WithTracing
static IFdbTransactionOptions WithTracing(IFdbTransactionOptions options, FdbTracingOptions tracing)
Set the transaction tracing options.
options— Transaction that will be configured for the current attempt.tracing— Tracing options
WithTransactionLog
static IFdbTransactionOptions WithTransactionLog(IFdbTransactionOptions options, string id, int? maxFieldLength = null)
Enables tracing for this transaction and logs results to the client trace logs.
options— Transaction that will be configured for the current attempt.id— String identifier to be used when tracing or profiling this transaction. The identifier must not exceed 100 characters.maxFieldLength— If non-null, sets the maximum escaped length of key and value fields to be logged to the trace file via the LOG_TRANSACTION option, after which the field will be truncated. A negative value disables truncation.
Client trace logging must be enabled via before the network thread is started, in order to get log output.
static IFdbTransactionOptions WithTransactionLog(IFdbTransactionOptions options, ReadOnlySpan<char> id, int? maxFieldLength = null)
Enables tracing for this transaction and logs results to the client trace logs.
options— Transaction that will be configured for the current attempt.id— String identifier to be used when tracing or profiling this transaction. The identifier must not exceed 100 characters.maxFieldLength— If non-null, sets the maximum escaped length of key and value fields to be logged to the trace file via the LOG_TRANSACTION option, after which the field will be truncated. A negative value disables truncation.
Client trace logging must be enabled via before the network thread is started, in order to get log output.
WithWriteAccessToSystemKeys
static IFdbTransactionOptions WithWriteAccessToSystemKeys(IFdbTransactionOptions options)
Allows this transaction to read and modify system keys (those that start with the byte 0xFF)
See