feat(cloud): report planner transport status
This commit is contained in:
@@ -34,6 +34,7 @@ class HostRegistration:
|
||||
host_id: str
|
||||
address: str | None
|
||||
last_seen_at: datetime
|
||||
planner_transport: Literal["direct", "cloud"] = "direct"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -61,6 +62,7 @@ class DevicePool:
|
||||
snapshot: list[Device],
|
||||
*,
|
||||
address: str | None = None,
|
||||
planner_transport: Literal["direct", "cloud"] = "direct",
|
||||
allow_device_takeover: bool = False,
|
||||
) -> None:
|
||||
"""Push a host's current device snapshot into the pool.
|
||||
@@ -70,7 +72,12 @@ class DevicePool:
|
||||
other hosts are untouched.
|
||||
"""
|
||||
now = utc_now()
|
||||
self.store.upsert_host(host_id, address=address, last_seen_at=now)
|
||||
self.store.upsert_host(
|
||||
host_id,
|
||||
address=address,
|
||||
last_seen_at=now,
|
||||
planner_transport=planner_transport,
|
||||
)
|
||||
devices = [self._to_pooled(device, host_id, now) for device in snapshot]
|
||||
if allow_device_takeover:
|
||||
self.store.replace_host_devices(
|
||||
|
||||
Reference in New Issue
Block a user