control.pb.swift 16 KB

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