Class FDBRecordContextConfig
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.FDBRecordContextConfig
-
public class FDBRecordContextConfig extends Object
A configuration struct that can be used to set various options on anFDBRecordContext
. Instances of this configuration object can be passed toFDBDatabase.openContext(FDBRecordContextConfig)
to create a new transaction with various parameters set according to the values specified here.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FDBRecordContextConfig.Builder
A builder ofFDBRecordContextConfig
s using the standard builder pattern.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areAssertionsEnabled()
Returns whether or not internal correctness assertions are enabled.Map<String,String>
getMdcContext()
Get the MDC context used to set additional keys and values when logging.FDBTransactionPriority
getPriority()
Get the priority for the created transaction.FDBStoreTimer
getTimer()
Get the timer to use to instrument events.String
getTransactionId()
Get the ID to use for the transaction in FDB logs.long
getTransactionTimeoutMillis()
Get the configured transaction timeout time in milliseconds.FDBDatabase.WeakReadSemantics
getWeakReadSemantics()
Get theFDBDatabase.WeakReadSemantics
configuration used when creating the transaction.boolean
isLogTransaction()
Get whether transaction is logged to FDB client logs.boolean
isSaveOpenStackTrace()
Get whether stack trace is recorded when context is opened.boolean
isTrackOpen()
Get whether open context is tracked in the associatedFDBDatabase
.static FDBRecordContextConfig.Builder
newBuilder()
Get a new builder for this class.FDBRecordContextConfig.Builder
toBuilder()
Convert the current configuration to a builder.
-
-
-
Method Detail
-
getMdcContext
@Nullable public Map<String,String> getMdcContext()
Get the MDC context used to set additional keys and values when logging.- Returns:
- the MDC context to use when logging
-
getTimer
@Nullable public FDBStoreTimer getTimer()
Get the timer to use to instrument events. This is especially useful for tracking and timing operations that interact with the database.- Returns:
- the timer to use to instrument events
-
getWeakReadSemantics
@Nullable public FDBDatabase.WeakReadSemantics getWeakReadSemantics()
Get theFDBDatabase.WeakReadSemantics
configuration used when creating the transaction. This is used to determine whether this transaction should be created with a cached read version and whether this transaction should set theTransactionOptions.setCausalReadRisky()
option.- Returns:
- the
FDBDatabase.WeakReadSemantics
to use when creating the transaction
-
getPriority
@Nonnull public FDBTransactionPriority getPriority()
Get the priority for the created transaction. For more details on that option, seeFDBTransactionPriority
.- Returns:
- the priority for the created transaction
-
getTransactionId
@Nullable public String getTransactionId()
Get the ID to use for the transaction in FDB logs. SeeFDBRecordContext
for more details.- Returns:
- the ID to use for the transaction in FDB logs
-
getTransactionTimeoutMillis
public long getTransactionTimeoutMillis()
Get the configured transaction timeout time in milliseconds. If set toFDBDatabaseFactory.DEFAULT_TR_TIMEOUT_MILLIS
, then the created transaction will use the default from theFDBDatabaseFactory
.- Returns:
- the transaction timeout time in milliseconds
-
areAssertionsEnabled
public boolean areAssertionsEnabled()
Returns whether or not internal correctness assertions are enabled.- Returns:
- whether or not internal correctness assertions are enabled
-
isLogTransaction
public boolean isLogTransaction()
Get whether transaction is logged to FDB client logs.- Returns:
true
if transaction is logged.
-
isTrackOpen
public boolean isTrackOpen()
Get whether open context is tracked in the associatedFDBDatabase
.- Returns:
true
if context is tracked.
-
isSaveOpenStackTrace
public boolean isSaveOpenStackTrace()
Get whether stack trace is recorded when context is opened.- Returns:
true
if stack trace is generated.
-
newBuilder
@Nonnull public static FDBRecordContextConfig.Builder newBuilder()
Get a new builder for this class.- Returns:
- a new builder for this class
-
toBuilder
@Nonnull public FDBRecordContextConfig.Builder toBuilder()
Convert the current configuration to a builder. This will set all options in the builder to their current values in this configuration object.- Returns:
- a new builder based on this configuration object
-
-