ServerFeatures.swift 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright 2019, gRPC Authors All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import Foundation
  17. import GRPC
  18. import NIO
  19. import NIOHTTP1
  20. /// Server features which may be required for tests.
  21. ///
  22. /// We use this enum to match up tests we can run on the NIO client against the NIO server at
  23. /// run time.
  24. ///
  25. /// These features are listed in the [gRPC interoperability test description
  26. /// specification](https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md).
  27. ///
  28. /// Missing features:
  29. /// - compressed response
  30. /// - compressed request
  31. /// - observe `ResponseParameter.interval_us`
  32. /// - echo authenticated username
  33. /// - echo authenticated OAuth scope
  34. ///
  35. /// - Note: This is not a complete set of features, only those used in either the client or server.
  36. public enum ServerFeature {
  37. /// See TestServiceProvider_NIO.emptyCall.
  38. case emptyCall
  39. /// See TestServiceProvider_NIO.unaryCall.
  40. case unaryCall
  41. /// See TestServiceProvider_NIO.cacheableUnaryCall.
  42. case cacheableUnaryCall
  43. /// When the client sets expect_compressed to true, the server expects the client request to be
  44. /// compressed. If it's not, it fails the RPC with INVALID_ARGUMENT. Note that
  45. /// `response_compressed` is present on both SimpleRequest (unary) and StreamingOutputCallRequest
  46. /// (streaming).
  47. case compressedRequest
  48. /// When the client sets response_compressed to true, the server's response is sent back
  49. /// compressed. Note that response_compressed is present on both SimpleRequest (unary) and
  50. /// StreamingOutputCallRequest (streaming).
  51. case compressedResponse
  52. /// See TestServiceProvider_NIO.streamingInputCall.
  53. case streamingInputCall
  54. /// See TestServiceProvider_NIO.streamingOutputCall.
  55. case streamingOutputCall
  56. /// See TestServiceProvider_NIO.fullDuplexCall.
  57. case fullDuplexCall
  58. /// When the client sends a `responseStatus` in the request payload, the server closes the stream
  59. /// with the status code and messsage contained within said `responseStatus`. The server will not
  60. /// process any further messages on the stream sent by the client. This can be used by clients to
  61. /// verify correct handling of different status codes and associated status messages end-to-end.
  62. case echoStatus
  63. /// When the client sends metadata with the key "x-grpc-test-echo-initial" with its request,
  64. /// the server sends back exactly this key and the corresponding value back to the client as
  65. /// part of initial metadata. When the client sends metadata with the key
  66. /// "x-grpc-test-echo-trailing-bin" with its request, the server sends back exactly this key
  67. /// and the corresponding value back to the client as trailing metadata.
  68. case echoMetadata
  69. }