This repository has been archived by the owner on Jul 24, 2021. It is now read-only.
create better "where are my relays?" endpoints #912
Labels
api
database
involves database schema or config changes, or non-trivial query authoring
enhancement
extends current functionality
maybe
needs-shell
needs accompanying changes in conch-shell
needs-ui
needs accompanying changes in conch-ui
Currently these endpoints exist:
GET /workspace/:workspace_id_or_name/relay
- list all relays located in the indicated workspace (and sub-workspaces beneath it)GET /workspace/:workspace_id_or_name/relay/:relay_id/device
- returns all the devices that have been reported by the provided relay that are presently located within this workspaceThe latter endpoint should be moved to be build-relative, as builds are much more important than workspaces going forward. However, the former endpoint is much more problematic: it depends on a device's current location being the same as the location it had when the relay attached to that device last submitted a report. The intent of this endpoint is "where are all my relays now?", but the way the query is written, we cannot provide that information accurately because we do not maintain a location history.
However, we can solve this problem by introducing a new join table, to link relays with rack locations (that is, a new
relay_location
table that has foreign keysrelay_id
,rack_id
,rack_unit_start
, much likedevice_location
). Then, we can update the relay_location table whenever we receive a device report from that relay, with the currently-known location of that device. This gives us another datapoint for finding relays -- we can look in the location the relay last sent a report from, and also the current location of the device the relay was attached to (in case it got moved along with the device).The text was updated successfully, but these errors were encountered: