firebase_ml_log_sdk.pb.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: proto/firebase_ml_log_sdk.proto
  6. //
  7. // For information on using the generated types, please see the documentation:
  8. // https://github.com/apple/swift-protobuf/
  9. // Copyright 2021 Google LLC
  10. //
  11. // Licensed under the Apache License, Version 2.0 (the "License");
  12. // you may not use this file except in compliance with the License.
  13. // You may obtain a copy of the License at
  14. //
  15. // http://www.apache.org/licenses/LICENSE-2.0
  16. //
  17. // Unless required by applicable law or agreed to in writing, software
  18. // distributed under the License is distributed on an "AS IS" BASIS,
  19. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. // See the License for the specific language governing permissions and
  21. // limitations under the License.
  22. import Foundation
  23. import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. enum EventName: SwiftProtobuf.Enum {
  34. typealias RawValue = Int
  35. case unknownEvent // = 0
  36. case modelDownload // = 100
  37. case modelUpdate // = 101
  38. case UNRECOGNIZED(Int)
  39. init() {
  40. self = .unknownEvent
  41. }
  42. init?(rawValue: Int) {
  43. switch rawValue {
  44. case 0: self = .unknownEvent
  45. case 100: self = .modelDownload
  46. case 101: self = .modelUpdate
  47. default: self = .UNRECOGNIZED(rawValue)
  48. }
  49. }
  50. var rawValue: Int {
  51. switch self {
  52. case .unknownEvent: return 0
  53. case .modelDownload: return 100
  54. case .modelUpdate: return 101
  55. case .UNRECOGNIZED(let i): return i
  56. }
  57. }
  58. }
  59. #if swift(>=4.2)
  60. extension EventName: CaseIterable {
  61. // The compiler won't synthesize support with the UNRECOGNIZED case.
  62. static var allCases: [EventName] = [
  63. .unknownEvent,
  64. .modelDownload,
  65. .modelUpdate,
  66. ]
  67. }
  68. #endif // swift(>=4.2)
  69. /// A list of error codes for various components of the system. For model downloading, the
  70. /// range of error codes is 100 to 199.
  71. enum ErrorCode: SwiftProtobuf.Enum {
  72. typealias RawValue = Int
  73. /// No error at all.
  74. case noError // = 0
  75. /// The download started on a valid condition but didn't finish successfully.
  76. case downloadFailed // = 104
  77. /// An unknown error has occurred. This is for conditions that should never
  78. /// happen. But we log them anyways. If there is a surge in UNKNOWN error
  79. /// codes, we need to check our code.
  80. case unknownError // = 9999
  81. case UNRECOGNIZED(Int)
  82. init() {
  83. self = .noError
  84. }
  85. init?(rawValue: Int) {
  86. switch rawValue {
  87. case 0: self = .noError
  88. case 104: self = .downloadFailed
  89. case 9999: self = .unknownError
  90. default: self = .UNRECOGNIZED(rawValue)
  91. }
  92. }
  93. var rawValue: Int {
  94. switch self {
  95. case .noError: return 0
  96. case .downloadFailed: return 104
  97. case .unknownError: return 9999
  98. case .UNRECOGNIZED(let i): return i
  99. }
  100. }
  101. }
  102. #if swift(>=4.2)
  103. extension ErrorCode: CaseIterable {
  104. // The compiler won't synthesize support with the UNRECOGNIZED case.
  105. static var allCases: [ErrorCode] = [
  106. .noError,
  107. .downloadFailed,
  108. .unknownError,
  109. ]
  110. }
  111. #endif // swift(>=4.2)
  112. /// Information about various parts of the system: app, Firebase, SDK.
  113. struct SystemInfo {
  114. // SwiftProtobuf.Message conformance is added in an extension below. See the
  115. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  116. // methods supported on all messages.
  117. /// The application's unique id. On iOS, this is the bundle ID.
  118. var appID: String = String()
  119. /// Application version string. On iOS, this is "version_number" + "#" + "build_number".
  120. var appVersion: String = String()
  121. /// Uniquely identifiable id associated with the Firebase project. Might be an
  122. /// empty string if the developer does not pass a correct FirebaseOptions with
  123. /// a valid Firebase Project ID.
  124. var firebaseProjectID: String = String()
  125. /// The API key of the firebase project.
  126. var apiKey: String = String()
  127. var unknownFields = SwiftProtobuf.UnknownStorage()
  128. init() {}
  129. }
  130. /// Information about models.
  131. struct ModelInfo {
  132. // SwiftProtobuf.Message conformance is added in an extension below. See the
  133. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  134. // methods supported on all messages.
  135. /// The name of the model defined by the model creator. This string should be
  136. /// meaningful to the creator and describes what the model does. For example,
  137. /// the name can be "mobile vision face recognition" or "speech to text".
  138. var name: String = String()
  139. /// The version of the model defined by the model creator.
  140. var version: String = String()
  141. /// The expected checksum (SHA256) of the model file. Only hash of models
  142. /// downloaded from cloud is logged.
  143. var hash: String = String()
  144. var modelType: ModelInfo.ModelType = .typeUnknown
  145. var unknownFields = SwiftProtobuf.UnknownStorage()
  146. /// The model type is currently envisioned to be used mainly for model
  147. /// download/update.
  148. enum ModelType: SwiftProtobuf.Enum {
  149. typealias RawValue = Int
  150. case typeUnknown // = 0
  151. case custom // = 1
  152. case UNRECOGNIZED(Int)
  153. init() {
  154. self = .typeUnknown
  155. }
  156. init?(rawValue: Int) {
  157. switch rawValue {
  158. case 0: self = .typeUnknown
  159. case 1: self = .custom
  160. default: self = .UNRECOGNIZED(rawValue)
  161. }
  162. }
  163. var rawValue: Int {
  164. switch self {
  165. case .typeUnknown: return 0
  166. case .custom: return 1
  167. case .UNRECOGNIZED(let i): return i
  168. }
  169. }
  170. }
  171. init() {}
  172. }
  173. #if swift(>=4.2)
  174. extension ModelInfo.ModelType: CaseIterable {
  175. // The compiler won't synthesize support with the UNRECOGNIZED case.
  176. static var allCases: [ModelInfo.ModelType] = [
  177. .typeUnknown,
  178. .custom,
  179. ]
  180. }
  181. #endif // swift(>=4.2)
  182. /// Detailed information about a model.
  183. /// The message used to be named "CustomModelOptions".
  184. struct ModelOptions {
  185. // SwiftProtobuf.Message conformance is added in an extension below. See the
  186. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  187. // methods supported on all messages.
  188. /// Inherent properties about the model: name, version, URI, source.
  189. var modelInfo: ModelInfo {
  190. get {return _modelInfo ?? ModelInfo()}
  191. set {_modelInfo = newValue}
  192. }
  193. /// Returns true if `modelInfo` has been explicitly set.
  194. var hasModelInfo: Bool {return self._modelInfo != nil}
  195. /// Clears the value of `modelInfo`. Subsequent reads from it will return its default value.
  196. mutating func clearModelInfo() {self._modelInfo = nil}
  197. /// True if models can be updated.
  198. var isModelUpdateEnabled: Bool = false
  199. var unknownFields = SwiftProtobuf.UnknownStorage()
  200. init() {}
  201. fileprivate var _modelInfo: ModelInfo? = nil
  202. }
  203. /// Information about model downloading. A single model download request may
  204. /// result in multiple log entries. "download_status" in the log entry indicates
  205. /// during which stage it is logged.
  206. /// This message used to be named "CustomModelDownloadLogEvent".
  207. struct ModelDownloadLogEvent {
  208. // SwiftProtobuf.Message conformance is added in an extension below. See the
  209. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  210. // methods supported on all messages.
  211. /// Model information and options for downloading.
  212. var options: ModelOptions {
  213. get {return _options ?? ModelOptions()}
  214. set {_options = newValue}
  215. }
  216. /// Returns true if `options` has been explicitly set.
  217. var hasOptions: Bool {return self._options != nil}
  218. /// Clears the value of `options`. Subsequent reads from it will return its default value.
  219. mutating func clearOptions() {self._options = nil}
  220. /// The rough duration of the download. This is not marked as
  221. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  222. /// We delegate the download to OS downloader. We may not be notified
  223. /// when the download completes, such as when the app is killed.
  224. var roughDownloadDurationMs: UInt64 = 0
  225. /// The error code for model download.
  226. var errorCode: ErrorCode = .noError
  227. /// The exact duration of the download. This is not marked as
  228. /// ST_SENSITIVE_TIMESTAMP because it is a duration instead of a timestamp.
  229. /// We know the exact duration when the download is completed while the app is
  230. /// still alive and receives the completed notification from OS downloader.
  231. var exactDownloadDurationMs: UInt64 = 0
  232. /// The download status.
  233. var downloadStatus: ModelDownloadLogEvent.DownloadStatus = .unknownStatus
  234. /// If this field is logged for DownloadStatus.MODEL_INFO_RETRIEVAL_FAILED, it
  235. /// is the http status code from the firebase console. See
  236. /// go/firebase-ml-model-hosting-design. Same on both Android and iOS.
  237. /// If this field is logged for DownloadStatus.FAILED, it is the http status
  238. /// code on iOS, and the DownloadManager's "COLUMN_REASON" value on Android. On
  239. /// iOS, the status code can be a negative integer.
  240. /// See
  241. /// https://developer.android.com/reference/android/app/DownloadManager.html#COLUMN_REASON
  242. var downloadFailureStatus: Int64 = 0
  243. var unknownFields = SwiftProtobuf.UnknownStorage()
  244. /// The download status. The model download is made up of two major stages: the
  245. /// retrieval of the model info in Firebase backend, and then the download of
  246. /// the model file in GCS. Whether or not the download is requested implicitly
  247. /// or explicitly does not affect the later stages of the download. As a
  248. /// result, later stages (i.e. enum tag 3+) do not distinguish between explicit
  249. /// and implicit triggering.
  250. enum DownloadStatus: SwiftProtobuf.Enum {
  251. typealias RawValue = Int
  252. case unknownStatus // = 0
  253. /// The download of the model file succeeded.
  254. case succeeded // = 7
  255. /// The download of the model file failed.
  256. case failed // = 8
  257. case UNRECOGNIZED(Int)
  258. init() {
  259. self = .unknownStatus
  260. }
  261. init?(rawValue: Int) {
  262. switch rawValue {
  263. case 0: self = .unknownStatus
  264. case 7: self = .succeeded
  265. case 8: self = .failed
  266. default: self = .UNRECOGNIZED(rawValue)
  267. }
  268. }
  269. var rawValue: Int {
  270. switch self {
  271. case .unknownStatus: return 0
  272. case .succeeded: return 7
  273. case .failed: return 8
  274. case .UNRECOGNIZED(let i): return i
  275. }
  276. }
  277. }
  278. init() {}
  279. fileprivate var _options: ModelOptions? = nil
  280. }
  281. #if swift(>=4.2)
  282. extension ModelDownloadLogEvent.DownloadStatus: CaseIterable {
  283. // The compiler won't synthesize support with the UNRECOGNIZED case.
  284. static var allCases: [ModelDownloadLogEvent.DownloadStatus] = [
  285. .unknownStatus,
  286. .succeeded,
  287. .failed,
  288. ]
  289. }
  290. #endif // swift(>=4.2)
  291. /// Main log event for FirebaseMl, that contains individual API events, like model
  292. /// download.
  293. /// NEXT ID: 44.
  294. struct FirebaseMlLogEvent {
  295. // SwiftProtobuf.Message conformance is added in an extension below. See the
  296. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  297. // methods supported on all messages.
  298. /// Information about various parts of the system: app, Firebase, SDK, TFLite.
  299. var systemInfo: SystemInfo {
  300. get {return _systemInfo ?? SystemInfo()}
  301. set {_systemInfo = newValue}
  302. }
  303. /// Returns true if `systemInfo` has been explicitly set.
  304. var hasSystemInfo: Bool {return self._systemInfo != nil}
  305. /// Clears the value of `systemInfo`. Subsequent reads from it will return its default value.
  306. mutating func clearSystemInfo() {self._systemInfo = nil}
  307. /// The event name.
  308. var eventName: EventName = .unknownEvent
  309. /// Model downloading logs.
  310. /// ==========================
  311. var modelDownloadLogEvent: ModelDownloadLogEvent {
  312. get {return _modelDownloadLogEvent ?? ModelDownloadLogEvent()}
  313. set {_modelDownloadLogEvent = newValue}
  314. }
  315. /// Returns true if `modelDownloadLogEvent` has been explicitly set.
  316. var hasModelDownloadLogEvent: Bool {return self._modelDownloadLogEvent != nil}
  317. /// Clears the value of `modelDownloadLogEvent`. Subsequent reads from it will return its default value.
  318. mutating func clearModelDownloadLogEvent() {self._modelDownloadLogEvent = nil}
  319. var unknownFields = SwiftProtobuf.UnknownStorage()
  320. init() {}
  321. fileprivate var _systemInfo: SystemInfo? = nil
  322. fileprivate var _modelDownloadLogEvent: ModelDownloadLogEvent? = nil
  323. }
  324. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  325. extension EventName: SwiftProtobuf._ProtoNameProviding {
  326. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  327. 0: .same(proto: "UNKNOWN_EVENT"),
  328. 100: .same(proto: "MODEL_DOWNLOAD"),
  329. 101: .same(proto: "MODEL_UPDATE"),
  330. ]
  331. }
  332. extension ErrorCode: SwiftProtobuf._ProtoNameProviding {
  333. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  334. 0: .same(proto: "NO_ERROR"),
  335. 104: .same(proto: "DOWNLOAD_FAILED"),
  336. 9999: .same(proto: "UNKNOWN_ERROR"),
  337. ]
  338. }
  339. extension SystemInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  340. static let protoMessageName: String = "SystemInfo"
  341. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  342. 1: .standard(proto: "app_id"),
  343. 2: .standard(proto: "app_version"),
  344. 3: .standard(proto: "firebase_project_id"),
  345. 7: .standard(proto: "api_key"),
  346. ]
  347. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  348. while let fieldNumber = try decoder.nextFieldNumber() {
  349. // The use of inline closures is to circumvent an issue where the compiler
  350. // allocates stack space for every case branch when no optimizations are
  351. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  352. switch fieldNumber {
  353. case 1: try { try decoder.decodeSingularStringField(value: &self.appID) }()
  354. case 2: try { try decoder.decodeSingularStringField(value: &self.appVersion) }()
  355. case 3: try { try decoder.decodeSingularStringField(value: &self.firebaseProjectID) }()
  356. case 7: try { try decoder.decodeSingularStringField(value: &self.apiKey) }()
  357. default: break
  358. }
  359. }
  360. }
  361. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  362. if !self.appID.isEmpty {
  363. try visitor.visitSingularStringField(value: self.appID, fieldNumber: 1)
  364. }
  365. if !self.appVersion.isEmpty {
  366. try visitor.visitSingularStringField(value: self.appVersion, fieldNumber: 2)
  367. }
  368. if !self.firebaseProjectID.isEmpty {
  369. try visitor.visitSingularStringField(value: self.firebaseProjectID, fieldNumber: 3)
  370. }
  371. if !self.apiKey.isEmpty {
  372. try visitor.visitSingularStringField(value: self.apiKey, fieldNumber: 7)
  373. }
  374. try unknownFields.traverse(visitor: &visitor)
  375. }
  376. static func ==(lhs: SystemInfo, rhs: SystemInfo) -> Bool {
  377. if lhs.appID != rhs.appID {return false}
  378. if lhs.appVersion != rhs.appVersion {return false}
  379. if lhs.firebaseProjectID != rhs.firebaseProjectID {return false}
  380. if lhs.apiKey != rhs.apiKey {return false}
  381. if lhs.unknownFields != rhs.unknownFields {return false}
  382. return true
  383. }
  384. }
  385. extension ModelInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  386. static let protoMessageName: String = "ModelInfo"
  387. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  388. 1: .same(proto: "name"),
  389. 2: .same(proto: "version"),
  390. 5: .same(proto: "hash"),
  391. 6: .standard(proto: "model_type"),
  392. ]
  393. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  394. while let fieldNumber = try decoder.nextFieldNumber() {
  395. // The use of inline closures is to circumvent an issue where the compiler
  396. // allocates stack space for every case branch when no optimizations are
  397. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  398. switch fieldNumber {
  399. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  400. case 2: try { try decoder.decodeSingularStringField(value: &self.version) }()
  401. case 5: try { try decoder.decodeSingularStringField(value: &self.hash) }()
  402. case 6: try { try decoder.decodeSingularEnumField(value: &self.modelType) }()
  403. default: break
  404. }
  405. }
  406. }
  407. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  408. if !self.name.isEmpty {
  409. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  410. }
  411. if !self.version.isEmpty {
  412. try visitor.visitSingularStringField(value: self.version, fieldNumber: 2)
  413. }
  414. if !self.hash.isEmpty {
  415. try visitor.visitSingularStringField(value: self.hash, fieldNumber: 5)
  416. }
  417. if self.modelType != .typeUnknown {
  418. try visitor.visitSingularEnumField(value: self.modelType, fieldNumber: 6)
  419. }
  420. try unknownFields.traverse(visitor: &visitor)
  421. }
  422. static func ==(lhs: ModelInfo, rhs: ModelInfo) -> Bool {
  423. if lhs.name != rhs.name {return false}
  424. if lhs.version != rhs.version {return false}
  425. if lhs.hash != rhs.hash {return false}
  426. if lhs.modelType != rhs.modelType {return false}
  427. if lhs.unknownFields != rhs.unknownFields {return false}
  428. return true
  429. }
  430. }
  431. extension ModelInfo.ModelType: SwiftProtobuf._ProtoNameProviding {
  432. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  433. 0: .same(proto: "TYPE_UNKNOWN"),
  434. 1: .same(proto: "CUSTOM"),
  435. ]
  436. }
  437. extension ModelOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  438. static let protoMessageName: String = "ModelOptions"
  439. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  440. 1: .standard(proto: "model_info"),
  441. 4: .standard(proto: "is_model_update_enabled"),
  442. ]
  443. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  444. while let fieldNumber = try decoder.nextFieldNumber() {
  445. // The use of inline closures is to circumvent an issue where the compiler
  446. // allocates stack space for every case branch when no optimizations are
  447. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  448. switch fieldNumber {
  449. case 1: try { try decoder.decodeSingularMessageField(value: &self._modelInfo) }()
  450. case 4: try { try decoder.decodeSingularBoolField(value: &self.isModelUpdateEnabled) }()
  451. default: break
  452. }
  453. }
  454. }
  455. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  456. if let v = self._modelInfo {
  457. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  458. }
  459. if self.isModelUpdateEnabled != false {
  460. try visitor.visitSingularBoolField(value: self.isModelUpdateEnabled, fieldNumber: 4)
  461. }
  462. try unknownFields.traverse(visitor: &visitor)
  463. }
  464. static func ==(lhs: ModelOptions, rhs: ModelOptions) -> Bool {
  465. if lhs._modelInfo != rhs._modelInfo {return false}
  466. if lhs.isModelUpdateEnabled != rhs.isModelUpdateEnabled {return false}
  467. if lhs.unknownFields != rhs.unknownFields {return false}
  468. return true
  469. }
  470. }
  471. extension ModelDownloadLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  472. static let protoMessageName: String = "ModelDownloadLogEvent"
  473. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  474. 1: .same(proto: "options"),
  475. 2: .standard(proto: "rough_download_duration_ms"),
  476. 3: .standard(proto: "error_code"),
  477. 4: .standard(proto: "exact_download_duration_ms"),
  478. 5: .standard(proto: "download_status"),
  479. 6: .standard(proto: "download_failure_status"),
  480. ]
  481. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  482. while let fieldNumber = try decoder.nextFieldNumber() {
  483. // The use of inline closures is to circumvent an issue where the compiler
  484. // allocates stack space for every case branch when no optimizations are
  485. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  486. switch fieldNumber {
  487. case 1: try { try decoder.decodeSingularMessageField(value: &self._options) }()
  488. case 2: try { try decoder.decodeSingularUInt64Field(value: &self.roughDownloadDurationMs) }()
  489. case 3: try { try decoder.decodeSingularEnumField(value: &self.errorCode) }()
  490. case 4: try { try decoder.decodeSingularUInt64Field(value: &self.exactDownloadDurationMs) }()
  491. case 5: try { try decoder.decodeSingularEnumField(value: &self.downloadStatus) }()
  492. case 6: try { try decoder.decodeSingularInt64Field(value: &self.downloadFailureStatus) }()
  493. default: break
  494. }
  495. }
  496. }
  497. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  498. if let v = self._options {
  499. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  500. }
  501. if self.roughDownloadDurationMs != 0 {
  502. try visitor.visitSingularUInt64Field(value: self.roughDownloadDurationMs, fieldNumber: 2)
  503. }
  504. if self.errorCode != .noError {
  505. try visitor.visitSingularEnumField(value: self.errorCode, fieldNumber: 3)
  506. }
  507. if self.exactDownloadDurationMs != 0 {
  508. try visitor.visitSingularUInt64Field(value: self.exactDownloadDurationMs, fieldNumber: 4)
  509. }
  510. if self.downloadStatus != .unknownStatus {
  511. try visitor.visitSingularEnumField(value: self.downloadStatus, fieldNumber: 5)
  512. }
  513. if self.downloadFailureStatus != 0 {
  514. try visitor.visitSingularInt64Field(value: self.downloadFailureStatus, fieldNumber: 6)
  515. }
  516. try unknownFields.traverse(visitor: &visitor)
  517. }
  518. static func ==(lhs: ModelDownloadLogEvent, rhs: ModelDownloadLogEvent) -> Bool {
  519. if lhs._options != rhs._options {return false}
  520. if lhs.roughDownloadDurationMs != rhs.roughDownloadDurationMs {return false}
  521. if lhs.errorCode != rhs.errorCode {return false}
  522. if lhs.exactDownloadDurationMs != rhs.exactDownloadDurationMs {return false}
  523. if lhs.downloadStatus != rhs.downloadStatus {return false}
  524. if lhs.downloadFailureStatus != rhs.downloadFailureStatus {return false}
  525. if lhs.unknownFields != rhs.unknownFields {return false}
  526. return true
  527. }
  528. }
  529. extension ModelDownloadLogEvent.DownloadStatus: SwiftProtobuf._ProtoNameProviding {
  530. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  531. 0: .same(proto: "UNKNOWN_STATUS"),
  532. 7: .same(proto: "SUCCEEDED"),
  533. 8: .same(proto: "FAILED"),
  534. ]
  535. }
  536. extension FirebaseMlLogEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  537. static let protoMessageName: String = "FirebaseMlLogEvent"
  538. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  539. 1: .standard(proto: "system_info"),
  540. 2: .standard(proto: "event_name"),
  541. 3: .standard(proto: "model_download_log_event"),
  542. ]
  543. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  544. while let fieldNumber = try decoder.nextFieldNumber() {
  545. // The use of inline closures is to circumvent an issue where the compiler
  546. // allocates stack space for every case branch when no optimizations are
  547. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  548. switch fieldNumber {
  549. case 1: try { try decoder.decodeSingularMessageField(value: &self._systemInfo) }()
  550. case 2: try { try decoder.decodeSingularEnumField(value: &self.eventName) }()
  551. case 3: try { try decoder.decodeSingularMessageField(value: &self._modelDownloadLogEvent) }()
  552. default: break
  553. }
  554. }
  555. }
  556. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  557. if let v = self._systemInfo {
  558. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  559. }
  560. if self.eventName != .unknownEvent {
  561. try visitor.visitSingularEnumField(value: self.eventName, fieldNumber: 2)
  562. }
  563. if let v = self._modelDownloadLogEvent {
  564. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  565. }
  566. try unknownFields.traverse(visitor: &visitor)
  567. }
  568. static func ==(lhs: FirebaseMlLogEvent, rhs: FirebaseMlLogEvent) -> Bool {
  569. if lhs._systemInfo != rhs._systemInfo {return false}
  570. if lhs.eventName != rhs.eventName {return false}
  571. if lhs._modelDownloadLogEvent != rhs._modelDownloadLogEvent {return false}
  572. if lhs.unknownFields != rhs.unknownFields {return false}
  573. return true
  574. }
  575. }