InMemoryDatabaseConnection
public final class InMemoryDatabaseConnection : DatabaseConnection
This class provides a database connection to an in-memory database.
-
Declaration
Swift
public let eventLoop: EventLoop
-
The last committed transaction version.
Declaration
Swift
public private(set) var currentVersion: Int64
-
This initializer creates a new database.
Declaration
Swift
public init(eventLoop: EventLoop)
-
This method starts a transaction on the database.
Declaration
Swift
public func startTransaction() -> Transaction
Return Value
The new transaction.
-
This method commits a transaction to the database.
The transaction must be one that was created by calling startTransaction on this database. Otherwise, it will be rejected.
If the transaction has added a read conflict on any keys that have changed since the transaction’s readVersion, this will reject the transaction.
If the transaction is valid this will merge in the keys and values that were changed in the transaction.
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.