From 82b4fdd5023e327fb0e05fcdbc813cc4ded0f73c Mon Sep 17 00:00:00 2001 From: Kirill Titov Date: Thu, 11 Apr 2019 19:53:29 +0300 Subject: [PATCH] Make API public again --- Sources/FDB/FDB.swift | 4 ++-- Sources/FDB/FDB/FDB+Errors.swift | 4 ++-- Sources/FDB/Transaction.swift | 16 ++++++++-------- Sources/FDB/Transaction/Transaction+NIO.swift | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Sources/FDB/FDB.swift b/Sources/FDB/FDB.swift index a4ab9f6..0b60e31 100644 --- a/Sources/FDB/FDB.swift +++ b/Sources/FDB/FDB.swift @@ -58,7 +58,7 @@ public class FDB { } /// Performs an explicit disconnect routine. - func disconnect() { + public func disconnect() { if !self.isConnected { FDB.logger.error("Trying to disconnect from FDB while not connected") return @@ -192,7 +192,7 @@ public class FDB { } /// Performs explicit connection to FDB cluster - func connect() throws { + public func connect() throws { _ = try self.getDB() FDB.logger.debug("Connected") } diff --git a/Sources/FDB/FDB/FDB+Errors.swift b/Sources/FDB/FDB/FDB+Errors.swift index 8f9f277..afb0ce3 100644 --- a/Sources/FDB/FDB/FDB+Errors.swift +++ b/Sources/FDB/FDB/FDB+Errors.swift @@ -5,7 +5,7 @@ public extension FDB { typealias Errno = fdb_error_t } -extension FDB.Errno { +internal extension FDB.Errno { /// Converts non-zero error number to throwable error func orThrow() throws { if self == 0 { @@ -263,7 +263,7 @@ public extension FDB { } /// Returns human-readable description of current FDB error - func getDescription() -> String { + public func getDescription() -> String { if self.errno == 8000 { return "You should replay this transaction" } diff --git a/Sources/FDB/Transaction.swift b/Sources/FDB/Transaction.swift index 85092fa..26324b4 100644 --- a/Sources/FDB/Transaction.swift +++ b/Sources/FDB/Transaction.swift @@ -30,7 +30,7 @@ public extension FDB { } /// Destroys current transaction. It becomes unusable after this. - func destroy() { + public func destroy() { fdb_transaction_destroy(self.pointer) } @@ -61,14 +61,14 @@ public extension FDB { /// Cancels the transaction. All pending or future uses of the transaction will return /// a `transaction_cancelled` error. The transaction can be used again after it is `reset`. - func cancel() { + public func cancel() { self.log("Cancelling transaction") fdb_transaction_cancel(self.pointer) } /// Reset transaction to its initial state. /// This is similar to creating a new transaction after destroying previous one. - func reset() { + public func reset() { self.log("Resetting transaction") fdb_transaction_reset(self.pointer) } @@ -77,7 +77,7 @@ public extension FDB { /// /// - parameters: /// - key: FDB key - func clear(key: AnyFDBKey) { + public func clear(key: AnyFDBKey) { let keyBytes = key.asFDBKey() fdb_transaction_clear(self.pointer, keyBytes, keyBytes.length) } @@ -87,7 +87,7 @@ public extension FDB { /// - parameters: /// - begin: Begin key /// - end: End key - func clear(begin: AnyFDBKey, end: AnyFDBKey) { + public func clear(begin: AnyFDBKey, end: AnyFDBKey) { let beginBytes = begin.asFDBKey() let endBytes = end.asFDBKey() fdb_transaction_clear_range(self.pointer, beginBytes, beginBytes.length, endBytes, endBytes.length) @@ -97,7 +97,7 @@ public extension FDB { /// /// - parameters: /// - range: Range key - func clear(range: FDB.RangeKey) { + public func clear(range: FDB.RangeKey) { self.clear(begin: range.begin, end: range.end) } @@ -108,7 +108,7 @@ public extension FDB { /// - _: Atomic operation /// - key: FDB key /// - value: Value bytes - func atomic(_ op: FDB.MutationType, key: AnyFDBKey, value: Bytes) { + public func atomic(_ op: FDB.MutationType, key: AnyFDBKey, value: Bytes) { let keyBytes = key.asFDBKey() fdb_transaction_atomic_op( self.pointer, @@ -126,7 +126,7 @@ public extension FDB { /// with error_code_past_version; if it is too new, subsequent reads may be delayed indefinitely and/or fail /// with error_code_future_version. If any of fdb_transaction_get_*() have been called /// on this transaction already, the result is undefined. - func setReadVersion(version: Int64) { + public func setReadVersion(version: Int64) { fdb_transaction_set_read_version(self.pointer, version) } } diff --git a/Sources/FDB/Transaction/Transaction+NIO.swift b/Sources/FDB/Transaction/Transaction+NIO.swift index 9dcc458..6eed9eb 100644 --- a/Sources/FDB/Transaction/Transaction+NIO.swift +++ b/Sources/FDB/Transaction/Transaction+NIO.swift @@ -2,7 +2,7 @@ import CFDB import NIO internal extension EventLoopFuture { - func checkingRetryableError(for transaction: FDB.Transaction) -> EventLoopFuture { + @usableFromInline func checkingRetryableError(for transaction: FDB.Transaction) -> EventLoopFuture { return self.flatMapError { error in guard let FDBError = error as? FDB.Error else { return self.eventLoop.makeFailedFuture(error)