public class FDB extends Object
selectAPIVersion(int).
This call is required before using any other part of the API. The call allows
an error to be thrown at this point to prevent client code from accessing a later library
with incorrect assumptions from the current version. The API version documented here is version
300.Database object to use is
to call open().
open() or
createCluster(), or started explicitly with a call to startNetwork().
| Modifier and Type | Method and Description |
|---|---|
Cluster |
createCluster()
Connects to the cluster specified by the
default fdb.cluster file.
|
Cluster |
createCluster(String clusterFilePath)
Connects to the cluster specified by
clusterFilePath. |
Cluster |
createCluster(String clusterFilePath,
Executor e)
Connects to the cluster specified by
clusterFilePath. |
Database |
open()
Initializes networking, connects with the
default fdb.cluster file,
and opens the default database.
|
Database |
open(String clusterFilePath)
Initializes networking, connects to the cluster specified by
clusterFilePath
and opens the database with the default name. |
Database |
open(String clusterFilePath,
byte[] databaseName)
Initializes networking, connects to the cluster specified by
clusterFilePath
and opens the database with the specified name. |
NetworkOptions |
options()
Returns a set of options that can be set on a the FoundationDB API.
|
static FDB |
selectAPIVersion(int version)
Select the version for the client API.
|
void |
startNetwork()
Initializes networking.
|
void |
startNetwork(Executor e)
Initializes networking.
|
void |
stopNetwork()
Stops the FoundationDB networking engine.
|
public NetworkOptions options()
startNetwork() and implicitly by calls to open() and
createCluster() (and their respective variants).public static FDB selectAPIVersion(int version) throws FDBException
version - the API version requiredFDBExceptionpublic Cluster createCluster() throws IllegalStateException, FDBException
startNetwork() had been called.Future that will be set to a FoundationDB Cluster.FDBException - on errors encountered starting the FoundationDB networking engineIllegalStateException - if the network had been previously stoppedpublic Cluster createCluster(String clusterFilePath) throws IllegalStateException, FDBException
clusterFilePath. If the FoundationDB network
has not been started, it will be started in the course of this call as if
startNetwork() had been called.clusterFilePath - the
cluster file
defining the FoundationDB cluster. This can be null if the
default fdb.cluster file
is to be used.Future that will be set to a FoundationDB Cluster.FDBException - on errors encountered starting the FoundationDB networking engineIllegalStateException - if the network had been previously stoppedpublic Cluster createCluster(String clusterFilePath, Executor e) throws FDBException, IllegalStateException
clusterFilePath. If the FoundationDB network
has not been started, it will be started in the course of this call. The supplied
Executor will be used as the default for the execution of all callbacks that
are produced from using the resulting Cluster.clusterFilePath - the
cluster file
defining the FoundationDB cluster. This can be null if the
default fdb.cluster file
is to be used.e - used to execute all callbacks from the Cluster.Future that will be set to a FoundationDB Cluster.FDBException - on errors encountered starting the FoundationDB networking engineIllegalStateException - if the network had been previously stoppedpublic Database open() throws FDBException
Future that will be set to a FoundationDB DatabaseFDBExceptionpublic Database open(String clusterFilePath) throws FDBException
clusterFilePath
and opens the database with the default name. The default database name of "DB" is used.clusterFilePath - the
cluster file
defining the FoundationDB cluster. This can be null if the
default fdb.cluster file
is to be used.Future that will be set to a FoundationDB DatabaseFDBExceptionpublic Database open(String clusterFilePath, byte[] databaseName) throws FDBException
clusterFilePath
and opens the database with the specified name. As of the current API version, the only
database that can be opened has a name equivalent to the ASCII encoding for "DB".
(This byte array created using "DB".getBytes()). Therefore, this function provides
no advantage over open(String).clusterFilePath - the
cluster file
defining the FoundationDB cluster. This can be null if the
default fdb.cluster file
is to be used.databaseName - the name of the database to load. Must be a byte array equivelent
to "DB".Future that will be set to a FoundationDB DatabaseFDBExceptionpublic void startNetwork()
throws FDBException,
IllegalStateException
startNetwork() will use the default thread pool to execute the
FoundationDB network.NetworkOptions.IllegalStateException - if the network has already been stoppedFDBExceptionNetworkOptionspublic void startNetwork(Executor e) throws FDBException, IllegalStateException
Executor. This
event loop is a blocking operation that is not
expected to terminate until the program in complete. This will therefore consume an
entire thread from e if e is a thread pool or will completely block
operation of a single threaded Executor.NetworkOptions. These options should be set before a call
to this method.IllegalStateException - if the network has already been stoppedFDBExceptionNetworkOptionspublic void stopNetwork()
throws FDBException
FDBException - on errors while stopping the network