mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-10-31 18:21:58 +08:00
Replace local Caffeine cache as the source of truth for driver and device online status with dc3_entity_state, a persistent state lease table backed by PostgreSQL. - Add EntityStateDO/Mapper/Manager persistence stack. - Add EntityStateExpiryScanner that scans expire_time every 15 seconds with lease_version recheck to avoid stale alarm writes. - Dual-write heartbeat path: DriverStateServiceImpl and DeviceStateServiceImpl now write dc3_entity_state first, then local cache. - All status queries (controllers, gRPC server, local facade, SystemHealthServiceImpl) read from dc3_entity_state. Rows missing or past expire_time return offline. - OfflineExpiryListener gains a DB dedup check to skip expiry events already handled by the scanner. - Add @EnableScheduling to DataApplication. - Add design doc docs/design/entity-state.md with full DDL. This resolves restart state loss, multi-instance inconsistency, and races between expiry checks and fresh heartbeats.