control.pb.swift 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: control.proto
  6. //
  7. // For information on using the generated types, please see the documentation:
  8. // https://github.com/apple/swift-protobuf/
  9. //
  10. // Copyright 2024, gRPC Authors All rights reserved.
  11. //
  12. // Licensed under the Apache License, Version 2.0 (the "License");
  13. // you may not use this file except in compliance with the License.
  14. // You may obtain a copy of the License at
  15. //
  16. // http://www.apache.org/licenses/LICENSE-2.0
  17. //
  18. // Unless required by applicable law or agreed to in writing, software
  19. // distributed under the License is distributed on an "AS IS" BASIS,
  20. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. // See the License for the specific language governing permissions and
  22. // limitations under the License.
  23. import Foundation
  24. import SwiftProtobuf
  25. // If the compiler emits an error on this type, it is because this file
  26. // was generated by a version of the `protoc` Swift plug-in that is
  27. // incompatible with the version of SwiftProtobuf to which you are linking.
  28. // Please ensure that you are building against the same version of the API
  29. // that was used to generate this file.
  30. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  31. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  32. typealias Version = _2
  33. }
  34. enum StatusCode: SwiftProtobuf.Enum {
  35. typealias RawValue = Int
  36. case ok // = 0
  37. case cancelled // = 1
  38. case unknown // = 2
  39. case invalidArgument // = 3
  40. case deadlineExceeded // = 4
  41. case notFound // = 5
  42. case alreadyExists // = 6
  43. case permissionDenied // = 7
  44. case resourceExhausted // = 8
  45. case failedPrecondition // = 9
  46. case aborted // = 10
  47. case outOfRange // = 11
  48. case unimplemented // = 12
  49. case `internal` // = 13
  50. case unavailable // = 14
  51. case dataLoss // = 15
  52. case unauthenticated // = 16
  53. case UNRECOGNIZED(Int)
  54. init() {
  55. self = .ok
  56. }
  57. init?(rawValue: Int) {
  58. switch rawValue {
  59. case 0: self = .ok
  60. case 1: self = .cancelled
  61. case 2: self = .unknown
  62. case 3: self = .invalidArgument
  63. case 4: self = .deadlineExceeded
  64. case 5: self = .notFound
  65. case 6: self = .alreadyExists
  66. case 7: self = .permissionDenied
  67. case 8: self = .resourceExhausted
  68. case 9: self = .failedPrecondition
  69. case 10: self = .aborted
  70. case 11: self = .outOfRange
  71. case 12: self = .unimplemented
  72. case 13: self = .internal
  73. case 14: self = .unavailable
  74. case 15: self = .dataLoss
  75. case 16: self = .unauthenticated
  76. default: self = .UNRECOGNIZED(rawValue)
  77. }
  78. }
  79. var rawValue: Int {
  80. switch self {
  81. case .ok: return 0
  82. case .cancelled: return 1
  83. case .unknown: return 2
  84. case .invalidArgument: return 3
  85. case .deadlineExceeded: return 4
  86. case .notFound: return 5
  87. case .alreadyExists: return 6
  88. case .permissionDenied: return 7
  89. case .resourceExhausted: return 8
  90. case .failedPrecondition: return 9
  91. case .aborted: return 10
  92. case .outOfRange: return 11
  93. case .unimplemented: return 12
  94. case .internal: return 13
  95. case .unavailable: return 14
  96. case .dataLoss: return 15
  97. case .unauthenticated: return 16
  98. case .UNRECOGNIZED(let i): return i
  99. }
  100. }
  101. }
  102. #if swift(>=4.2)
  103. extension StatusCode: CaseIterable {
  104. // The compiler won't synthesize support with the UNRECOGNIZED case.
  105. static let allCases: [StatusCode] = [
  106. .ok,
  107. .cancelled,
  108. .unknown,
  109. .invalidArgument,
  110. .deadlineExceeded,
  111. .notFound,
  112. .alreadyExists,
  113. .permissionDenied,
  114. .resourceExhausted,
  115. .failedPrecondition,
  116. .aborted,
  117. .outOfRange,
  118. .unimplemented,
  119. .internal,
  120. .unavailable,
  121. .dataLoss,
  122. .unauthenticated,
  123. ]
  124. }
  125. #endif // swift(>=4.2)
  126. struct ControlInput {
  127. // SwiftProtobuf.Message conformance is added in an extension below. See the
  128. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  129. // methods supported on all messages.
  130. /// Whether metadata should be echo'd back in the initial metadata.
  131. ///
  132. /// Ignored if the initial metadata has already been sent back to the
  133. /// client.
  134. ///
  135. /// Each header field name in the request headers will be prefixed with
  136. /// "echo-". For example the header field name "foo" will be returned
  137. /// as "echo-foo. Note that semicolons aren't valid in HTTP header field
  138. /// names (apart from pseudo headers). As such all semicolons should be
  139. /// removed (":path" should become "echo-path").
  140. var echoMetadataInHeaders: Bool = false
  141. /// Parameters for response messages.
  142. var messageParams: PayloadParameters {
  143. get {return _messageParams ?? PayloadParameters()}
  144. set {_messageParams = newValue}
  145. }
  146. /// Returns true if `messageParams` has been explicitly set.
  147. var hasMessageParams: Bool {return self._messageParams != nil}
  148. /// Clears the value of `messageParams`. Subsequent reads from it will return its default value.
  149. mutating func clearMessageParams() {self._messageParams = nil}
  150. /// The number of response messages.
  151. var numberOfMessages: Int32 = 0
  152. /// The status code and message to use at the end of the RPC.
  153. ///
  154. /// If this is set then the RPC will be ended after `number_of_messages`
  155. /// messages have been sent back to the client.
  156. var status: RPCStatus {
  157. get {return _status ?? RPCStatus()}
  158. set {_status = newValue}
  159. }
  160. /// Returns true if `status` has been explicitly set.
  161. var hasStatus: Bool {return self._status != nil}
  162. /// Clears the value of `status`. Subsequent reads from it will return its default value.
  163. mutating func clearStatus() {self._status = nil}
  164. /// Whether the response should be trailers only.
  165. ///
  166. /// Ignored unless it's set on the first message on the stream. When set
  167. /// the RPC will be completed with a trailers-only response using the
  168. /// status code and message from 'status'. The request metadata will be
  169. /// included if 'echo_metadata_in_trailers' is set.
  170. ///
  171. /// If this is set then 'number_of_messages', 'message_params', and
  172. /// 'echo_metadata_in_headers' are ignored.
  173. var isTrailersOnly: Bool = false
  174. /// Whether metadata should be echo'd back in the trailing metadata.
  175. ///
  176. /// Ignored unless 'status' is set.
  177. ///
  178. /// Each header field name in the request headers will be prefixed with
  179. /// "echo-". For example the header field name "foo" will be returned
  180. /// as "echo-foo. Note that semicolons aren't valid in HTTP header field
  181. /// names (apart from pseudo headers). As such all semicolons should be
  182. /// removed (":path" should become "echo-path").
  183. var echoMetadataInTrailers: Bool = false
  184. var unknownFields = SwiftProtobuf.UnknownStorage()
  185. init() {}
  186. fileprivate var _messageParams: PayloadParameters? = nil
  187. fileprivate var _status: RPCStatus? = nil
  188. }
  189. struct RPCStatus {
  190. // SwiftProtobuf.Message conformance is added in an extension below. See the
  191. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  192. // methods supported on all messages.
  193. /// Status code indicating the outcome of the RPC.
  194. var code: StatusCode = .ok
  195. /// The message to include with the 'code' at the end of the RPC.
  196. var message: String = String()
  197. var unknownFields = SwiftProtobuf.UnknownStorage()
  198. init() {}
  199. }
  200. struct PayloadParameters {
  201. // SwiftProtobuf.Message conformance is added in an extension below. See the
  202. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  203. // methods supported on all messages.
  204. /// The number of bytes to put into the output payload.
  205. var size: Int32 = 0
  206. /// The conent to use in the payload. The value is truncated to an octet.
  207. var content: UInt32 = 0
  208. var unknownFields = SwiftProtobuf.UnknownStorage()
  209. init() {}
  210. }
  211. struct ControlOutput {
  212. // SwiftProtobuf.Message conformance is added in an extension below. See the
  213. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  214. // methods supported on all messages.
  215. var payload: Data = Data()
  216. var unknownFields = SwiftProtobuf.UnknownStorage()
  217. init() {}
  218. }
  219. #if swift(>=5.5) && canImport(_Concurrency)
  220. extension StatusCode: @unchecked Sendable {}
  221. extension ControlInput: @unchecked Sendable {}
  222. extension RPCStatus: @unchecked Sendable {}
  223. extension PayloadParameters: @unchecked Sendable {}
  224. extension ControlOutput: @unchecked Sendable {}
  225. #endif // swift(>=5.5) && canImport(_Concurrency)
  226. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  227. extension StatusCode: SwiftProtobuf._ProtoNameProviding {
  228. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  229. 0: .same(proto: "OK"),
  230. 1: .same(proto: "CANCELLED"),
  231. 2: .same(proto: "UNKNOWN"),
  232. 3: .same(proto: "INVALID_ARGUMENT"),
  233. 4: .same(proto: "DEADLINE_EXCEEDED"),
  234. 5: .same(proto: "NOT_FOUND"),
  235. 6: .same(proto: "ALREADY_EXISTS"),
  236. 7: .same(proto: "PERMISSION_DENIED"),
  237. 8: .same(proto: "RESOURCE_EXHAUSTED"),
  238. 9: .same(proto: "FAILED_PRECONDITION"),
  239. 10: .same(proto: "ABORTED"),
  240. 11: .same(proto: "OUT_OF_RANGE"),
  241. 12: .same(proto: "UNIMPLEMENTED"),
  242. 13: .same(proto: "INTERNAL"),
  243. 14: .same(proto: "UNAVAILABLE"),
  244. 15: .same(proto: "DATA_LOSS"),
  245. 16: .same(proto: "UNAUTHENTICATED"),
  246. ]
  247. }
  248. extension ControlInput: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  249. static let protoMessageName: String = "ControlInput"
  250. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  251. 1: .standard(proto: "echo_metadata_in_headers"),
  252. 2: .standard(proto: "message_params"),
  253. 3: .standard(proto: "number_of_messages"),
  254. 5: .same(proto: "status"),
  255. 6: .standard(proto: "is_trailers_only"),
  256. 4: .standard(proto: "echo_metadata_in_trailers"),
  257. ]
  258. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  259. while let fieldNumber = try decoder.nextFieldNumber() {
  260. // The use of inline closures is to circumvent an issue where the compiler
  261. // allocates stack space for every case branch when no optimizations are
  262. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  263. switch fieldNumber {
  264. case 1: try { try decoder.decodeSingularBoolField(value: &self.echoMetadataInHeaders) }()
  265. case 2: try { try decoder.decodeSingularMessageField(value: &self._messageParams) }()
  266. case 3: try { try decoder.decodeSingularInt32Field(value: &self.numberOfMessages) }()
  267. case 4: try { try decoder.decodeSingularBoolField(value: &self.echoMetadataInTrailers) }()
  268. case 5: try { try decoder.decodeSingularMessageField(value: &self._status) }()
  269. case 6: try { try decoder.decodeSingularBoolField(value: &self.isTrailersOnly) }()
  270. default: break
  271. }
  272. }
  273. }
  274. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  275. // The use of inline closures is to circumvent an issue where the compiler
  276. // allocates stack space for every if/case branch local when no optimizations
  277. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  278. // https://github.com/apple/swift-protobuf/issues/1182
  279. if self.echoMetadataInHeaders != false {
  280. try visitor.visitSingularBoolField(value: self.echoMetadataInHeaders, fieldNumber: 1)
  281. }
  282. try { if let v = self._messageParams {
  283. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  284. } }()
  285. if self.numberOfMessages != 0 {
  286. try visitor.visitSingularInt32Field(value: self.numberOfMessages, fieldNumber: 3)
  287. }
  288. if self.echoMetadataInTrailers != false {
  289. try visitor.visitSingularBoolField(value: self.echoMetadataInTrailers, fieldNumber: 4)
  290. }
  291. try { if let v = self._status {
  292. try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
  293. } }()
  294. if self.isTrailersOnly != false {
  295. try visitor.visitSingularBoolField(value: self.isTrailersOnly, fieldNumber: 6)
  296. }
  297. try unknownFields.traverse(visitor: &visitor)
  298. }
  299. static func ==(lhs: ControlInput, rhs: ControlInput) -> Bool {
  300. if lhs.echoMetadataInHeaders != rhs.echoMetadataInHeaders {return false}
  301. if lhs._messageParams != rhs._messageParams {return false}
  302. if lhs.numberOfMessages != rhs.numberOfMessages {return false}
  303. if lhs._status != rhs._status {return false}
  304. if lhs.isTrailersOnly != rhs.isTrailersOnly {return false}
  305. if lhs.echoMetadataInTrailers != rhs.echoMetadataInTrailers {return false}
  306. if lhs.unknownFields != rhs.unknownFields {return false}
  307. return true
  308. }
  309. }
  310. extension RPCStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  311. static let protoMessageName: String = "RPCStatus"
  312. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  313. 1: .same(proto: "code"),
  314. 2: .same(proto: "message"),
  315. ]
  316. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  317. while let fieldNumber = try decoder.nextFieldNumber() {
  318. // The use of inline closures is to circumvent an issue where the compiler
  319. // allocates stack space for every case branch when no optimizations are
  320. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  321. switch fieldNumber {
  322. case 1: try { try decoder.decodeSingularEnumField(value: &self.code) }()
  323. case 2: try { try decoder.decodeSingularStringField(value: &self.message) }()
  324. default: break
  325. }
  326. }
  327. }
  328. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  329. if self.code != .ok {
  330. try visitor.visitSingularEnumField(value: self.code, fieldNumber: 1)
  331. }
  332. if !self.message.isEmpty {
  333. try visitor.visitSingularStringField(value: self.message, fieldNumber: 2)
  334. }
  335. try unknownFields.traverse(visitor: &visitor)
  336. }
  337. static func ==(lhs: RPCStatus, rhs: RPCStatus) -> Bool {
  338. if lhs.code != rhs.code {return false}
  339. if lhs.message != rhs.message {return false}
  340. if lhs.unknownFields != rhs.unknownFields {return false}
  341. return true
  342. }
  343. }
  344. extension PayloadParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  345. static let protoMessageName: String = "PayloadParameters"
  346. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  347. 1: .same(proto: "size"),
  348. 2: .same(proto: "content"),
  349. ]
  350. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  351. while let fieldNumber = try decoder.nextFieldNumber() {
  352. // The use of inline closures is to circumvent an issue where the compiler
  353. // allocates stack space for every case branch when no optimizations are
  354. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  355. switch fieldNumber {
  356. case 1: try { try decoder.decodeSingularInt32Field(value: &self.size) }()
  357. case 2: try { try decoder.decodeSingularUInt32Field(value: &self.content) }()
  358. default: break
  359. }
  360. }
  361. }
  362. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  363. if self.size != 0 {
  364. try visitor.visitSingularInt32Field(value: self.size, fieldNumber: 1)
  365. }
  366. if self.content != 0 {
  367. try visitor.visitSingularUInt32Field(value: self.content, fieldNumber: 2)
  368. }
  369. try unknownFields.traverse(visitor: &visitor)
  370. }
  371. static func ==(lhs: PayloadParameters, rhs: PayloadParameters) -> Bool {
  372. if lhs.size != rhs.size {return false}
  373. if lhs.content != rhs.content {return false}
  374. if lhs.unknownFields != rhs.unknownFields {return false}
  375. return true
  376. }
  377. }
  378. extension ControlOutput: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  379. static let protoMessageName: String = "ControlOutput"
  380. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  381. 1: .same(proto: "payload"),
  382. ]
  383. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  384. while let fieldNumber = try decoder.nextFieldNumber() {
  385. // The use of inline closures is to circumvent an issue where the compiler
  386. // allocates stack space for every case branch when no optimizations are
  387. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  388. switch fieldNumber {
  389. case 1: try { try decoder.decodeSingularBytesField(value: &self.payload) }()
  390. default: break
  391. }
  392. }
  393. }
  394. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  395. if !self.payload.isEmpty {
  396. try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 1)
  397. }
  398. try unknownFields.traverse(visitor: &visitor)
  399. }
  400. static func ==(lhs: ControlOutput, rhs: ControlOutput) -> Bool {
  401. if lhs.payload != rhs.payload {return false}
  402. if lhs.unknownFields != rhs.unknownFields {return false}
  403. return true
  404. }
  405. }