feat: handle AdminResult.RateLimited from SDK, update MeshTopology API

- Add AdminException.RateLimited to domain exception hierarchy
- Handle AdminResult.RateLimited in SdkRadioController.unwrap()
- Update MeshTopologyService for SDK's new suspend API:
  topology.nodes → topology.nodes(), topology.edgeCount → edgeCount()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-06 13:52:20 -05:00
parent 046efd50dd
commit 52aaa4d926
3 changed files with 6 additions and 2 deletions
@@ -56,7 +56,7 @@ class MeshTopologyService {
mutex.withLock {
topology.addNeighborInfo(info)
_edges.value = topology.allEdges()
_nodeCount.value = topology.nodes.size
_nodeCount.value = topology.nodes().size
}
Logger.d { "[Topology] Ingested neighbors from ${info.nodeId}: ${info.neighbors.size} edges" }
}
@@ -66,7 +66,7 @@ class MeshTopologyService {
mutex.withLock {
topology.removeNode(nodeId)
_edges.value = topology.allEdges()
_nodeCount.value = topology.nodes.size
_nodeCount.value = topology.nodes().size
}
}
@@ -405,6 +405,7 @@ class SdkRadioController(
is AdminResult.Unauthorized -> throw AdminException.Unauthorized()
is AdminResult.NodeUnreachable -> throw AdminException.NodeUnreachable()
is AdminResult.SessionKeyExpired -> throw AdminException.SessionKeyExpired()
is AdminResult.RateLimited -> throw AdminException.RateLimited()
is AdminResult.Failed -> throw AdminException.RoutingError(routingError.name)
}
}
@@ -39,4 +39,7 @@ sealed class AdminException(message: String) : Exception(message) {
/** Device reported a routing error not covered by the other subtypes. */
class RoutingError(val errorName: String) : AdminException("Routing error: $errorName")
/** Device rate-limited the request; back off before retrying. */
class RateLimited : AdminException("Rate limit exceeded")
}