Browse Source

Remove some unnecessary `internal` declarations.

Daniel Alm 8 years ago
parent
commit
0ec0398249

+ 2 - 2
Sources/gRPC/ByteBuffer.swift

@@ -21,13 +21,13 @@ import Foundation // for String.Encoding
 /// Representation of raw data that may be sent and received using gRPC
 public class ByteBuffer {
   /// Pointer to underlying C representation
-  internal var underlyingByteBuffer: UnsafeMutableRawPointer
+  var underlyingByteBuffer: UnsafeMutableRawPointer
 
   /// Creates a ByteBuffer from an underlying C representation.
   /// The ByteBuffer takes ownership of the passed-in representation.
   ///
   /// - Parameter underlyingByteBuffer: the underlying C representation
-  internal init(underlyingByteBuffer: UnsafeMutableRawPointer) {
+  init(underlyingByteBuffer: UnsafeMutableRawPointer) {
     self.underlyingByteBuffer = underlyingByteBuffer
   }
 

+ 1 - 1
Sources/gRPC/Call.swift

@@ -190,7 +190,7 @@ public class Call {
   /// - Parameter operations: group of operations to be performed
   /// - Returns: the result of initiating the call
   /// - Throws: `CallError` if fails to call.
-  internal func perform(_ operations: OperationGroup) throws {
+  func perform(_ operations: OperationGroup) throws {
     completionQueue.register(operations)
     Call.callMutex.lock()
     let error = cgrpc_call_perform(underlyingCall, operations.underlyingOperations, operations.tag)

+ 13 - 13
Sources/gRPC/CompletionQueue.swift

@@ -20,7 +20,7 @@
 import Foundation
 
 /// A type indicating the kind of event returned by the completion queue
-internal enum CompletionType {
+enum CompletionType {
   case queueShutdown
   case queueTimeout
   case complete
@@ -41,12 +41,12 @@ internal enum CompletionType {
 }
 
 /// An event that is returned by the completion queue
-internal struct CompletionQueueEvent {
-  internal var type: CompletionType
-  internal var success: Int32
-  internal var tag: Int64
+struct CompletionQueueEvent {
+  var type: CompletionType
+  var success: Int32
+  var tag: Int64
 
-  internal init(_ event: grpc_event) {
+  init(_ event: grpc_event) {
     type = CompletionType.completionType(event.type)
     success = event.success
     tag = cgrpc_event_tag(event)
@@ -54,9 +54,9 @@ internal struct CompletionQueueEvent {
 }
 
 /// A gRPC Completion Queue
-internal class CompletionQueue {
+class CompletionQueue {
   /// Optional user-provided name for the queue
-  internal var name: String?
+  var name: String?
 
   /// Pointer to underlying C representation
   private var underlyingCompletionQueue: UnsafeMutableRawPointer
@@ -79,7 +79,7 @@ internal class CompletionQueue {
   ///
   /// - Parameter timeout: a timeout value in seconds
   /// - Returns: a grpc_completion_type code indicating the result of waiting
-  internal func wait(timeout: TimeInterval) -> CompletionQueueEvent {
+  func wait(timeout: TimeInterval) -> CompletionQueueEvent {
     let event = cgrpc_completion_queue_get_next_event(underlyingCompletionQueue, timeout)
     return CompletionQueueEvent(event)
   }
@@ -87,7 +87,7 @@ internal class CompletionQueue {
   /// Register an operation group for handling upon completion
   ///
   /// - Parameter operationGroup: the operation group to handle
-  internal func register(_ operationGroup: OperationGroup) {
+  func register(_ operationGroup: OperationGroup) {
     operationGroupsMutex.lock()
     operationGroups[operationGroup.tag] = operationGroup
     operationGroupsMutex.unlock()
@@ -97,7 +97,7 @@ internal class CompletionQueue {
   ///
   /// - Parameter callbackQueue: a DispatchQueue to use to call the completion handler
   /// - Parameter completion: a completion handler that is called when the queue stops running
-  internal func runToCompletion(callbackQueue: DispatchQueue? = DispatchQueue.main,
+  func runToCompletion(callbackQueue: DispatchQueue? = DispatchQueue.main,
                                 _ completion: @escaping () -> Void) {
     // run the completion queue on a new background thread
     DispatchQueue.global().async {
@@ -153,12 +153,12 @@ internal class CompletionQueue {
   }
 
   /// Runs a completion queue
-  internal func run() {
+  func run() {
     runToCompletion(callbackQueue: nil) {}
   }
 
   /// Shuts down a completion queue
-  internal func shutdown() {
+  func shutdown() {
     cgrpc_completion_queue_shutdown(underlyingCompletionQueue)
   }
 }

+ 2 - 2
Sources/gRPC/Handler.swift

@@ -24,13 +24,13 @@ public class Handler {
   private var underlyingHandler: UnsafeMutableRawPointer
 
   /// Completion queue for handler response operations
-  internal var completionQueue: CompletionQueue
+  var completionQueue: CompletionQueue
 
   /// Metadata received with the request
   public var requestMetadata: Metadata
 
   /// A Call object that can be used to respond to the request
-  internal lazy var call: Call = {
+  lazy var call: Call = {
     Call(underlyingCall: cgrpc_handler_get_call(self.underlyingHandler),
          owned: false,
          completionQueue: self.completionQueue)

+ 10 - 10
Sources/gRPC/OperationGroup.swift

@@ -18,7 +18,7 @@
 #endif
 
 /// A collection of gRPC operations
-internal class OperationGroup {
+class OperationGroup {
   /// A mutex for synchronizing tag generation
   static let tagMutex = Mutex()
 
@@ -26,7 +26,7 @@ internal class OperationGroup {
   private static var nextTag: Int64 = 1
 
   /// Automatically-assigned tag that is used by the completion queue that watches this group.
-  internal var tag: Int64
+  var tag: Int64
 
   /// The call associated with the operation group. Retained while the operations are running.
   private var call: Call
@@ -38,13 +38,13 @@ internal class OperationGroup {
   private var underlyingObservers: [UnsafeMutableRawPointer] = []
 
   /// Pointer to underlying C representation
-  internal var underlyingOperations: UnsafeMutableRawPointer?
+  var underlyingOperations: UnsafeMutableRawPointer?
 
   /// Completion handler that is called when the group completes
-  internal var completion: ((OperationGroup) throws -> Void)
+  var completion: ((OperationGroup) throws -> Void)
 
   /// Indicates that the OperationGroup completed successfully
-  internal var success: Bool = false
+  var success: Bool = false
 
   /// Creates the underlying observer needed to run an operation
   ///
@@ -112,7 +112,7 @@ internal class OperationGroup {
   /// Gets the message that was received
   ///
   /// - Returns: message
-  internal func receivedMessage() -> ByteBuffer? {
+  func receivedMessage() -> ByteBuffer? {
     for (i, operation) in operations.enumerated() {
       switch operation {
       case .receiveMessage:
@@ -130,7 +130,7 @@ internal class OperationGroup {
   /// Gets initial metadata that was received
   ///
   /// - Returns: metadata
-  internal func receivedInitialMetadata() -> Metadata? {
+  func receivedInitialMetadata() -> Metadata? {
     for (i, operation) in operations.enumerated() {
       switch operation {
       case .receiveInitialMetadata:
@@ -145,7 +145,7 @@ internal class OperationGroup {
   /// Gets a status code that was received
   ///
   /// - Returns: status code
-  internal func receivedStatusCode() -> Int? {
+  func receivedStatusCode() -> Int? {
     for (i, operation) in operations.enumerated() {
       switch operation {
       case .receiveStatusOnClient:
@@ -160,7 +160,7 @@ internal class OperationGroup {
   /// Gets a status message that was received
   ///
   /// - Returns: status message
-  internal func receivedStatusMessage() -> String? {
+  func receivedStatusMessage() -> String? {
     for (i, operation) in operations.enumerated() {
       switch operation {
       case .receiveStatusOnClient:
@@ -182,7 +182,7 @@ internal class OperationGroup {
   /// Gets trailing metadata that was received
   ///
   /// - Returns: metadata
-  internal func receivedTrailingMetadata() -> Metadata? {
+  func receivedTrailingMetadata() -> Metadata? {
     for (i, operation) in operations.enumerated() {
       switch operation {
       case .receiveStatusOnClient: