Three option classes with fluent API: NetworkOptions, DatabaseOptions, TransactionOptions.
Set before opening database:
use CrazyGoat\FoundationDB\FoundationDB as FDB;
FDB::apiVersion(730);
FDB::networkOptions()
->setTraceEnable('/var/log/fdb/')
->setTraceFormat('json')
->setTraceLogGroup('my-app');
$db = FDB::open();Tracing:
setTraceEnable— Enable trace logging to directorysetTraceFormat— Set trace format ('json' or 'xml')setTraceRollSize— Set trace file roll sizesetTraceMaxLogsSize— Set maximum total log sizesetTraceLogGroup— Set log group identifiersetTraceClockSource— Set clock source for tracessetTraceFileIdentifier— Set trace file identifiersetTraceShareAmongClientThreads— Share trace files across threadssetTraceInitializeOnSetup— Initialize tracing on setupsetTracePartialFileSuffix— Set partial file suffix
TLS:
setTlsCertBytes— Set TLS certificate from bytessetTlsCertPath— Set TLS certificate from file pathsetTlsKeyBytes— Set TLS key from bytessetTlsKeyPath— Set TLS key from file pathsetTlsVerifyPeers— Set TLS peer verificationsetTlsCaBytes— Set CA certificate from bytessetTlsCaPath— Set CA certificate from file pathsetTlsPassword— Set TLS password
Multi-version:
setDisableMultiVersionClientApi— Disable multi-version client APIsetExternalClientLibrary— Load external client librarysetExternalClientDirectory— Set external client directorysetDisableLocalClient— Disable local clientsetClientThreadsPerVersion— Set client threads per version
Other:
setKnob— Set arbitrary knob valuesetCallbacksOnExternalThreads— Enable callbacks on external threadssetDisableClientStatisticsLogging— Disable client statistics loggingsetEnableRunLoopProfiling— Enable run loop profilingsetDisableClientBypass— Disable client bypasssetClientTmpDir— Set client temporary directory
Set after opening database:
$db->options()
->setTransactionTimeout(10_000)
->setTransactionRetryLimit(5)
->setTransactionMaxRetryDelay(1000);Transaction defaults:
setTransactionTimeout— Default transaction timeout (ms)setTransactionRetryLimit— Default retry limitsetTransactionMaxRetryDelay— Default max retry delay (ms)setTransactionSizeLimit— Default transaction size limit
Cache:
setLocationCacheSize— Set location cache sizesetMaxWatches— Set maximum watches
Identity:
setMachineId— Set machine identifiersetDatacenterId— Set datacenter identifier
Snapshot:
setSnapshotRywEnable— Enable snapshot read-your-writessetSnapshotRywDisable— Disable snapshot read-your-writes
Other:
setTransactionLoggingMaxFieldLength— Set max field length for loggingsetTransactionCausalReadRisky— Enable risky causal readssetTransactionAutomaticIdempotency— Enable automatic idempotencysetTransactionBypassUnreadable— Bypass unreadable keyssetTransactionUsedDuringCommitProtectionDisable— Disable commit protectionsetTransactionReportConflictingKeys— Report conflicting keys
Set within transaction:
$db->transact(function (Transaction $tr) {
$tr->options()
->setTimeout(5000)
->setRetryLimit(3)
->setPriorityBatch()
->setReadYourWritesDisable();
// ... operations
});Timeouts:
setTimeout— Transaction timeout (ms)setRetryLimit— Retry limitsetMaxRetryDelay— Max retry delay (ms)setSizeLimit— Transaction size limit
Priority:
setPrioritySystemImmediate— System immediate prioritysetPriorityBatch— Batch priority
Read priority:
setReadPriorityNormal— Normal read prioritysetReadPriorityLow— Low read prioritysetReadPriorityHigh— High read priority
Causal:
setCausalWriteRisky— Risky causal writessetCausalReadRisky— Risky causal readssetCausalReadDisable— Disable causal reads
Durability:
setDurabilityDatacenter— Datacenter durabilitysetDurabilityRisky— Risky durability
System keys:
setAccessSystemKeys— Access system keyssetReadSystemKeys— Read system keyssetRawAccess— Raw access mode
Snapshot:
setSnapshotRywEnable— Enable snapshot read-your-writessetSnapshotRywDisable— Disable snapshot read-your-writes
Debugging:
setDebugRetryLogging— Enable retry loggingsetDebugTransactionIdentifier— Set transaction identifiersetLogTransaction— Log transactionsetTransactionLoggingMaxFieldLength— Set max field lengthsetServerRequestTracing— Enable server request tracing
Conflict:
setNextWriteNoWriteConflictRange— Skip conflict range for next writesetReadYourWritesDisable— Disable read-your-writessetReportConflictingKeys— Report conflicting keys
Special keys:
setSpecialKeySpaceRelaxed— Relaxed special key spacesetSpecialKeySpaceEnableWrites— Enable writes to special key space
Other:
setLockAware— Lock aware modesetReadLockAware— Read lock awaresetUsedDuringCommitProtectionDisable— Disable commit protectionsetUseProvisionalProxies— Use provisional proxiessetTag— Set transaction tagsetAutoThrottleTag— Set auto-throttle tagsetBypassUnreadable— Bypass unreadablesetUseGrvCache— Use GRV cachesetBypassStorageQuota— Bypass storage quotasetIncludePortInAddress— Include port in addresssetReadServerSideCacheEnable— Enable server-side cachesetReadServerSideCacheDisable— Disable server-side cache
All setters return self, enabling method chaining:
$tr->options()
->setTimeout(5000)
->setRetryLimit(3)
->setPriorityBatch();