public interface Database extends Disposable, TransactionContext
Database is stored on a FoundationDB Cluster.
Transactions are used to manipulate data within a single
Database -- multiple, concurrent
Transactions on a Database enforce ACID properties.TransactionContext interface. When used on a Database these
methods will call Transaction#commit() after user code has been
executed. These methods will not return successfully until commit() has
returned successfully.| Modifier and Type | Method and Description |
|---|---|
Transaction |
createTransaction()
Creates a
Transaction that operates on this Database. |
DatabaseOptions |
options()
Returns a set of options that can be set on a
Database |
<T> T |
read(Function<? super ReadTransaction,T> retryable)
Runs a read-only transactional function against this
Database with retry logic. |
<T> T |
read(PartialFunction<? super ReadTransaction,T> retryable)
Runs a read-only transactional function against this
Database with retry logic. |
<T> Future<T> |
readAsync(Function<? super ReadTransaction,Future<T>> retryable)
Runs a read-only transactional function against this
Database with retry logic. |
<T> PartialFuture<T> |
readAsync(PartialFunction<? super ReadTransaction,? extends PartialFuture<T>> retryable)
Runs a read-only transactional function against this
Database with retry logic. |
<T> T |
run(Function<? super Transaction,T> retryable)
Runs a transactional function against this
Database with retry logic. |
<T> T |
run(PartialFunction<? super Transaction,T> retryable)
Runs a transactional function against this
Database with retry logic. |
<T> Future<T> |
runAsync(Function<? super Transaction,Future<T>> retryable)
Runs a transactional function against this
Database with retry logic. |
<T> PartialFuture<T> |
runAsync(PartialFunction<? super Transaction,? extends PartialFuture<T>> retryable)
Runs a transactional function against this
Database with retry logic. |
disposeTransaction createTransaction()
Transaction that operates on this Database.Transaction that reads from and writes to this Database.DatabaseOptions options()
DatabaseDatabase<T> T read(Function<? super ReadTransaction,T> retryable)
Database with retry logic.
apply(ReadTransaction) will be called on the
supplied Function until a non-retryable
FDBException (or any Throwable other than an FDBException)
is thrown. This call is blocking -- this
method will not return until the Function has been called and completed without error.read in interface ReadTransactionContextretryable - the block of logic to execute in a Transaction against
this databaseretryable<T> T read(PartialFunction<? super ReadTransaction,T> retryable) throws Exception
Database with retry logic. Use
this formulation of read(Function) if the user code being executed
throws a checked exception.read in interface ReadTransactionContextretryable - the block of logic to execute in a ReadTransaction against
this databaseretryableException - if non-transient database errors are encountered or user code throws any other errorread(Function)<T> Future<T> readAsync(Function<? super ReadTransaction,Future<T>> retryable)
Database with retry logic.
apply(ReadTransaction) will be called on the
supplied Function until a non-retryable
FDBException (or any Throwable other than an FDBException)
is thrown. This call is non-blocking -- this
method will return immediately and with a Future that will be
set when the Function has been called and completed without error.retryable, or received from the
database, will be set on the returned Future.readAsync in interface ReadTransactionContextretryable - the block of logic to execute in a ReadTransaction against
this databaseFuture that will be set to the value returned by the last call
to retryable<T> PartialFuture<T> readAsync(PartialFunction<? super ReadTransaction,? extends PartialFuture<T>> retryable)
Database with retry logic. Use
this formulation of the non-blocking readAsync(Function) if the user code being executed
throws a checked exception.readAsync in interface ReadTransactionContextretryable - the block of logic to execute in a ReadTransaction against
this databasePartialFuture that will be set to the value returned by the last call
to retryableread(Function)<T> T run(Function<? super Transaction,T> retryable)
Database with retry logic.
apply(Transaction) will be called on the
supplied Function until a non-retryable
FDBException (or any Throwable other than an FDBException)
is thrown or commit(),
when called after apply(), returns success. This call is blocking -- this
method will not return until commit() has been called and returned success.run in interface TransactionContextretryable - the block of logic to execute in a Transaction against
this databaseretryable<T> T run(PartialFunction<? super Transaction,T> retryable) throws Exception
Database with retry logic. Use
this formulation of run(Function) if the user code being executed
throws a checked exception.run in interface TransactionContextretryable - the block of logic to execute in a Transaction against
this databaseretryableException - if non-transient database errors are encountered or user code throws any other errorrun(Function)<T> Future<T> runAsync(Function<? super Transaction,Future<T>> retryable)
Database with retry logic.
apply(Transaction) will be called on the
supplied Function until a non-retryable
FDBException (or any Throwable other than an FDBException)
is thrown or commit(),
when called after apply(), returns success. This call is non-blocking -- this
method will return immediately and with a Future that will be
set when commit() has been called and returned success.retryable, or received from the
database, will be set on the returned Future.runAsync in interface TransactionContextretryable - the block of logic to execute in a Transaction against
this databaseFuture that will be set to the value returned by the last call
to retryable<T> PartialFuture<T> runAsync(PartialFunction<? super Transaction,? extends PartialFuture<T>> retryable)
Database with retry logic. Use
this formulation of the non-blocking runAsync(Function) if the user code being executed
throws a checked exception.runAsync in interface TransactionContextretryable - the block of logic to execute in a Transaction against
this databasePartialFuture that will be set to the value returned by the last call
to retryablerun(Function)