// DO NOT EDIT. // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: jobs.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ ///* /// Stable Diffusion RPC service for Apple Platforms. import Foundation import SwiftProtobuf // If the compiler emits an error on this type, it is because this file // was generated by a version of the `protoc` Swift plug-in that is // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } ///* /// Represents the current state of a job. public enum SdJobState: SwiftProtobuf.Enum { public typealias RawValue = Int ///* /// The job is in an unknown state. case unknown // = 0 ///* /// The job is queued. It has not started the work. case queued // = 1 ///* /// The job is running. The work has been started. case running // = 2 ///* /// The job is completed. The work has been completed. case completed // = 3 ///* /// The job is cancelled. An actor requested cancellation. case cancelled // = 4 case UNRECOGNIZED(Int) public init() { self = .unknown } public init?(rawValue: Int) { switch rawValue { case 0: self = .unknown case 1: self = .queued case 2: self = .running case 3: self = .completed case 4: self = .cancelled default: self = .UNRECOGNIZED(rawValue) } } public var rawValue: Int { switch self { case .unknown: return 0 case .queued: return 1 case .running: return 2 case .completed: return 3 case .cancelled: return 4 case .UNRECOGNIZED(let i): return i } } } #if swift(>=4.2) extension SdJobState: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static var allCases: [SdJobState] = [ .unknown, .queued, .running, .completed, .cancelled, ] } #endif // swift(>=4.2) ///* /// Represents a job that is active public struct SdJob { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// Unique job identifier. public var id: UInt64 = 0 ///* /// Job host identifier. public var host: UInt64 = 0 ///* /// The current state of the job. public var state: SdJobState = .unknown ///* /// The percentage of completion for the entire job. public var overallPercentageComplete: Float = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a request to get the state of a job. public struct SdGetJobRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// The job id to retrieve the current state for. public var id: UInt64 = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a response to getting the state of a job. public struct SdGetJobResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// The current state of the job. public var job: SdJob { get {return _job ?? SdJob()} set {_job = newValue} } /// Returns true if `job` has been explicitly set. public var hasJob: Bool {return self._job != nil} /// Clears the value of `job`. Subsequent reads from it will return its default value. public mutating func clearJob() {self._job = nil} public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} fileprivate var _job: SdJob? = nil } ///* /// Represents a request to cancel a job. public struct SdCancelJobRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// The job id to cancel. public var id: UInt64 = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a response to cancel a job. public struct SdCancelJobResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents a request to stream job updates. public struct SdStreamJobUpdatesRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// The job id to stream updates for. If this is not set or is zero, /// all job updates will be sent. public var id: UInt64 = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } ///* /// Represents an update to a job. public struct SdJobUpdate { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. ///* /// The current state of the job. public var job: SdJob { get {return _job ?? SdJob()} set {_job = newValue} } /// Returns true if `job` has been explicitly set. public var hasJob: Bool {return self._job != nil} /// Clears the value of `job`. Subsequent reads from it will return its default value. public mutating func clearJob() {self._job = nil} public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} fileprivate var _job: SdJob? = nil } #if swift(>=5.5) && canImport(_Concurrency) extension SdJobState: @unchecked Sendable {} extension SdJob: @unchecked Sendable {} extension SdGetJobRequest: @unchecked Sendable {} extension SdGetJobResponse: @unchecked Sendable {} extension SdCancelJobRequest: @unchecked Sendable {} extension SdCancelJobResponse: @unchecked Sendable {} extension SdStreamJobUpdatesRequest: @unchecked Sendable {} extension SdJobUpdate: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "gay.pizza.stable.diffusion" extension SdJobState: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "unknown"), 1: .same(proto: "queued"), 2: .same(proto: "running"), 3: .same(proto: "completed"), 4: .same(proto: "cancelled"), ] } extension SdJob: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".Job" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "host"), 3: .same(proto: "state"), 4: .standard(proto: "overall_percentage_complete"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularUInt64Field(value: &self.id) }() case 2: try { try decoder.decodeSingularUInt64Field(value: &self.host) }() case 3: try { try decoder.decodeSingularEnumField(value: &self.state) }() case 4: try { try decoder.decodeSingularFloatField(value: &self.overallPercentageComplete) }() default: break } } } public func traverse(visitor: inout V) throws { if self.id != 0 { try visitor.visitSingularUInt64Field(value: self.id, fieldNumber: 1) } if self.host != 0 { try visitor.visitSingularUInt64Field(value: self.host, fieldNumber: 2) } if self.state != .unknown { try visitor.visitSingularEnumField(value: self.state, fieldNumber: 3) } if self.overallPercentageComplete != 0 { try visitor.visitSingularFloatField(value: self.overallPercentageComplete, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdJob, rhs: SdJob) -> Bool { if lhs.id != rhs.id {return false} if lhs.host != rhs.host {return false} if lhs.state != rhs.state {return false} if lhs.overallPercentageComplete != rhs.overallPercentageComplete {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGetJobRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetJobRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularUInt64Field(value: &self.id) }() default: break } } } public func traverse(visitor: inout V) throws { if self.id != 0 { try visitor.visitSingularUInt64Field(value: self.id, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGetJobRequest, rhs: SdGetJobRequest) -> Bool { if lhs.id != rhs.id {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdGetJobResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".GetJobResponse" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "job"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularMessageField(value: &self._job) }() default: break } } } public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._job { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) } }() try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdGetJobResponse, rhs: SdGetJobResponse) -> Bool { if lhs._job != rhs._job {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdCancelJobRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".CancelJobRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularUInt64Field(value: &self.id) }() default: break } } } public func traverse(visitor: inout V) throws { if self.id != 0 { try visitor.visitSingularUInt64Field(value: self.id, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdCancelJobRequest, rhs: SdCancelJobRequest) -> Bool { if lhs.id != rhs.id {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdCancelJobResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".CancelJobResponse" public static let _protobuf_nameMap = SwiftProtobuf._NameMap() public mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } public func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdCancelJobResponse, rhs: SdCancelJobResponse) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdStreamJobUpdatesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".StreamJobUpdatesRequest" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularUInt64Field(value: &self.id) }() default: break } } } public func traverse(visitor: inout V) throws { if self.id != 0 { try visitor.visitSingularUInt64Field(value: self.id, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdStreamJobUpdatesRequest, rhs: SdStreamJobUpdatesRequest) -> Bool { if lhs.id != rhs.id {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension SdJobUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".JobUpdate" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "job"), ] public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularMessageField(value: &self._job) }() default: break } } } public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._job { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) } }() try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: SdJobUpdate, rhs: SdJobUpdate) -> Bool { if lhs._job != rhs._job {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }