Class FDBSystemOperations
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.FDBSystemOperations
-
@API(EXPERIMENTAL) public class FDBSystemOperations extends Object
View of an FoundationDB database used for accessing system and special keys. These are special keys defined within special system keyspaces that contain information about the underlying FoundationDB cluster, about the client configuration, or other information available through another API.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getClusterFilePath(FDBDatabaseRunner runner)
Get the file system path to the cluster file used.static CompletableFuture<String>
getClusterFilePathAsync(FDBDatabaseRunner runner)
Get the file system path to the cluster file used.static String
getConnectionString(FDBDatabaseRunner runner)
Get the connection string used to connect to the FDB cluster.static CompletableFuture<String>
getConnectionStringAsync(FDBDatabaseRunner runner)
Get the connection string used to connect to the FDB cluster.static String
getPrimaryDatacenter(FDBDatabaseRunner runner)
Get the primary datacenter of the underlying cluster.static CompletableFuture<String>
getPrimaryDatacenterAsync(FDBDatabaseRunner runner)
Get the primary datacenter of the underlying cluster.
-
-
-
Method Detail
-
getPrimaryDatacenterAsync
@Nonnull public static CompletableFuture<String> getPrimaryDatacenterAsync(@Nonnull FDBDatabaseRunner runner)
Get the primary datacenter of the underlying cluster. This will return the datacenter ID (if set) of the datacenter currently serving as the primary, which (by definition) is where the transaction subsystem will be recruited. This is mostly relevant for multi-region configurations, where this value might change if the cluster decides that it needs to fail over to a secondary region. The returned datacenter ID will benull
if the FDB cluster's datacenter has not been set.Note that this operation must read this information from the database's storage and uses its own transaction.
- Parameters:
runner
- a runner to use to perform the operation- Returns:
- a future that will complete with the primary datacenter of the cluster for the database underlying
runner
-
getPrimaryDatacenter
@Nullable public static String getPrimaryDatacenter(@Nonnull FDBDatabaseRunner runner)
Get the primary datacenter of the underlying cluster. This is a blocking version ofgetPrimaryDatacenterAsync(FDBDatabaseRunner)
. If the FDB cluster's primary datacenter has not been set, this will returnnull
.- Parameters:
runner
- a runner to use to perform the operation- Returns:
- the primary datacenter of the database underlying
runner
- See Also:
getPrimaryDatacenterAsync(FDBDatabaseRunner)
-
getConnectionStringAsync
@Nonnull public static CompletableFuture<String> getConnectionStringAsync(@Nonnull FDBDatabaseRunner runner)
Get the connection string used to connect to the FDB cluster. This string essentially contains the contents of the cluster file, though it may change if the cluster's coordinators change. Note that even though this operation requires having a database connection (in the transaction) and returns a future (as the client may schedule to complete the work at a later time), it does not actually perform any network calls but reads the value from the client's local memory.For more information, see the documentation on the cluster file format in the FoundationDB documentation.
- Parameters:
runner
- a runner to use to perform the operation- Returns:
- a future that will contain the current cluster connection string
-
getConnectionString
@Nullable public static String getConnectionString(@Nonnull FDBDatabaseRunner runner)
Get the connection string used to connect to the FDB cluster. This is a synchronous version ofgetConnectionStringAsync(FDBDatabaseRunner)
- Parameters:
runner
- a runner to use to perform the operation- Returns:
- the current cluster connection string
- See Also:
getConnectionStringAsync(FDBDatabaseRunner)
-
getClusterFilePathAsync
@Nonnull public static CompletableFuture<String> getClusterFilePathAsync(@Nonnull FDBDatabaseRunner runner)
Get the file system path to the cluster file used. Note that this differs from the value that is returned byFDBDatabase.getClusterFile()
in that that function may returnnull
if the cluster file is set to the system default. This function, however, requests the information from the native client, and so it will return the resolved cluster file (e.g., returning the path to the system default instead ofnull
). Note that even though this operation returns a future, it does not need to perform any network calls but instead answers this question from the client's local memory.- Parameters:
runner
- a runner to use to perform the operation- Returns:
- a future that will contain the cluster file path
-
getClusterFilePath
@Nullable public static String getClusterFilePath(@Nonnull FDBDatabaseRunner runner)
Get the file system path to the cluster file used. This is a synchronous version ofgetClusterFilePathAsync(FDBDatabaseRunner)
.- Parameters:
runner
- a transaction to use to perform the operation- Returns:
- the cluster file path
- See Also:
getClusterFilePathAsync(FDBDatabaseRunner)
-
-