Pārlūkot izejas kodu

Make LengthPrefixedMessageReader internal (#674)

George Barnett 6 gadi atpakaļ
vecāks
revīzija
e969195ad2

+ 5 - 5
Sources/GRPC/LengthPrefixedMessageReader.swift

@@ -30,13 +30,13 @@ import Logging
 ///
 /// - SeeAlso:
 /// [gRPC Protocol](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md)
-public struct LengthPrefixedMessageReader {
+internal struct LengthPrefixedMessageReader {
   public typealias Mode = GRPCError.Origin
 
   /// The mechanism that messages will be compressed with.
-  public var compressionMechanism: CompressionMechanism
+  var compressionMechanism: CompressionMechanism
 
-  public init(mode: Mode, compressionMechanism: CompressionMechanism) {
+  init(mode: Mode, compressionMechanism: CompressionMechanism) {
     self.mode = mode
     self.compressionMechanism = compressionMechanism
   }
@@ -79,7 +79,7 @@ public struct LengthPrefixedMessageReader {
   }
 
   /// Appends data to the buffer from which messages will be read.
-  public mutating func append(buffer: inout ByteBuffer) {
+  internal mutating func append(buffer: inout ByteBuffer) {
     guard buffer.readableBytes > 0 else {
       return
     }
@@ -98,7 +98,7 @@ public struct LengthPrefixedMessageReader {
   /// - Returns: A buffer containing a message if one has been read, or `nil` if not enough
   ///   bytes have been consumed to return a message.
   /// - Throws: Throws an error if the compression algorithm is not supported.
-  public mutating func nextMessage() throws -> ByteBuffer? {
+  internal mutating func nextMessage() throws -> ByteBuffer? {
     switch try self.processNextState() {
     case .needMoreData:
       self.nilBufferIfPossible()

+ 1 - 2
Tests/GRPCTests/LengthPrefixedMessageReaderTests.swift

@@ -13,9 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import Foundation
 import XCTest
-import GRPC
+@testable import GRPC
 import NIO
 import Logging