ClusterDatabaseConnection
public class ClusterDatabaseConnection : DatabaseConnection
This class provides a connection to a real database cluster.
-
Declaration
Swift
public let eventLoop: EventLoop
-
This type wraps an error thrown by the FoundationDB C API.
See moreDeclaration
Swift
public struct FdbApiError : Error
-
This method opens a connection to a database cluster.
Throws
If we’re not able to connect to the database, this will throw a FutureError.Declaration
Swift
public init(fromClusterFile clusterPath: String? = nil, eventLoop: EventLoop) throws
Parameters
clusterPath
The path to the cluster file.
-
This method starts a transaction.
Declaration
Swift
public func startTransaction() -> Transaction
Return Value
The transaction.
-
This method commits a transaction.
This must be a transaction createe on this database.
Declaration
Swift
public func commit(transaction: Transaction) -> EventLoopFuture<()>
Parameters
transaction
The transaction to commit.
Return Value
A future that will fire when the transaction has finished committing. If the transaction is rejected, the future will throw an error.