| | |
| | | /** upsert 本轮检测柜观测,未返回设备保留到逻辑过期。 */ |
| | | void recordCabinets(List<CabinetCandidate> candidates); |
| | | |
| | | /** 替换指定适配器的采集器观测,使已删除模拟采集器立即消失。 */ |
| | | void replaceCollectors(String adapterCode, List<CollectorCandidate> candidates); |
| | | |
| | | /** 删除指定适配器的全部发现候选;仅供人工重置或实机联调清理。 */ |
| | | void removeAdapter(String adapterCode); |
| | | |
| | |
| | | return snapshot(now).cabinets().stream().filter(item -> item.deviceCode().equals(deviceCode)).findFirst(); |
| | | } |
| | | |
| | | /** 按设备编码查询指定时刻未过期的采集器观测;在线和登记状态由业务层校验。 */ |
| | | default Optional<CollectorCandidate> findCollector(String deviceCode, Instant now) |
| | | { |
| | | return snapshot(now).collectors().stream().filter(item -> item.deviceCode().equals(deviceCode)).findFirst(); |
| | | } |
| | | |
| | | record CandidateSnapshot(List<CabinetCandidate> cabinets, List<CollectorCandidate> collectors) |
| | | record CandidateSnapshot(List<CabinetCandidate> cabinets) |
| | | { |
| | | public CandidateSnapshot |
| | | { |
| | | cabinets = List.copyOf(cabinets); |
| | | collectors = List.copyOf(collectors); |
| | | } |
| | | } |
| | | |
| | |
| | | this(identity, online, workStatus, observedAt, latestSnapshot, lastDataAt, null); |
| | | } |
| | | } |
| | | |
| | | record CollectorCandidate(String adapterCode, String deviceCode, String ip, String mac, String name, |
| | | String manufacturer, String model, int channelCount, boolean online, |
| | | Instant observedAt, Instant expiresAt) { } |
| | | } |