Class 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 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 be null 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
      • 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
      • 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 by FDBDatabase.getClusterFile() in that that function may return null 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 of null). 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