mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
81 lines
4.4 KiB
Swift
81 lines
4.4 KiB
Swift
//
|
|
// FleetUnit.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct FleetUnit: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Host is the unit's hostname. Empty for a unit that is not one host: a cluster row has no hostname to report. */
|
|
public var host: String?
|
|
/** Kind is what the unit IS: laptop, cloud, gpu, cluster, machine or worker. */
|
|
public var kind: String?
|
|
/** Label is the name to show a human — a target's label, a worker's hostname, a machine's display name. Empty when the source has none to give. */
|
|
public var label: String?
|
|
/** Metrics is the unit's latest utilization: its own live snapshot when it keeps one (a run-target's heartbeat wins), else the newest sample from the series for the SAME source. Absent means nothing is known about this unit's load — which is deliberately not the same as a reading of zero. */
|
|
public var metrics: FleetMetrics?
|
|
/** Queued is how many renders are waiting on THIS GPU's own lane in the org's gpu-jobs queue. BYO units only — an agent run-target dispatches, it does not queue — and omitted when nothing is waiting. */
|
|
public var queued: Int64?
|
|
/** Running is what the unit is executing right now: agent sessions in flight for a run-target, claimed renders for a BYO GPU. */
|
|
public var running: Int64?
|
|
/** Sessions is how many agent sessions are open on this unit. Always present, and 0 for a source that cannot host agent sessions at all — a fact about that plane, not a gap in the reading. */
|
|
public var sessions: Int64?
|
|
/** Source is the plane this row came from: \"agent\" (a linked run-target), \"byo\" (a worker or cluster the org dialed in) or \"visor\" (a machine Hanzo provisioned). It is half the row's identity, and it says which face owns the unit — /v1/agent/targets, /v1/compute/fleet/workers, /v1/compute/machines. */
|
|
public var source: String?
|
|
/** Spec is the unit's static capability. Absent when the source reported none — unknown capability, never a zeroed one. */
|
|
public var spec: FleetSpec?
|
|
/** Status is liveness in the SOURCE's own vocabulary, because each plane decides it differently: a run-target's is derived from its heartbeat, a BYO worker's is online/offline on the 90s window, a BYO cluster's is \"attached\", and a Visor machine's is the provider's word for its lifecycle state. */
|
|
public var status: String?
|
|
/** Unit is the SOURCE's own id for this unit — a run-target id, a BYO worker id, a Visor machine name — so a row links straight back to the face that owns it. It is unique within a source, not across them: two planes may mint the same id, which is why (source, unit) together is the identity. */
|
|
public var unit: String?
|
|
|
|
public init(host: String? = nil, kind: String? = nil, label: String? = nil, metrics: FleetMetrics? = nil, queued: Int64? = nil, running: Int64? = nil, sessions: Int64? = nil, source: String? = nil, spec: FleetSpec? = nil, status: String? = nil, unit: String? = nil) {
|
|
self.host = host
|
|
self.kind = kind
|
|
self.label = label
|
|
self.metrics = metrics
|
|
self.queued = queued
|
|
self.running = running
|
|
self.sessions = sessions
|
|
self.source = source
|
|
self.spec = spec
|
|
self.status = status
|
|
self.unit = unit
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case host
|
|
case kind
|
|
case label
|
|
case metrics
|
|
case queued
|
|
case running
|
|
case sessions
|
|
case source
|
|
case spec
|
|
case status
|
|
case unit
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(host, forKey: .host)
|
|
try container.encodeIfPresent(kind, forKey: .kind)
|
|
try container.encodeIfPresent(label, forKey: .label)
|
|
try container.encodeIfPresent(metrics, forKey: .metrics)
|
|
try container.encodeIfPresent(queued, forKey: .queued)
|
|
try container.encodeIfPresent(running, forKey: .running)
|
|
try container.encodeIfPresent(sessions, forKey: .sessions)
|
|
try container.encodeIfPresent(source, forKey: .source)
|
|
try container.encodeIfPresent(spec, forKey: .spec)
|
|
try container.encodeIfPresent(status, forKey: .status)
|
|
try container.encodeIfPresent(unit, forKey: .unit)
|
|
}
|
|
}
|
|
|