Commit Graph

7 Commits

Author SHA1 Message Date
caoqianming 24b1d3546b Move shared feeder plumbing into core 2026-04-21 16:04:03 +08:00
caoqianming 6814e9eae9 refactor: migrate platform handlers to core, centralize routes and event persistence
- Move source/point/equipment/tag/page handlers from feeder to plc_platform_core
  using State<PlatformContext>; feeder re-exports via handler modules
- Keep batch_set_point_value in feeder (requires app-specific write key auth)
- Add PlatformEvent enum and persist_and_broadcast() in core for platform event
  persistence to DB + WebSocket broadcast
- Add PlatformContext::emit_event() that handles both sink notification and
  async persistence in one call
- Add platform_routes<S>() in core for centralized route registration;
  both feeder and ops merge it instead of duplicating route definitions
- Implement FromRef<AppState> for PlatformContext in both apps
- Add FeederPlatformEventSink adapter bridging core events to feeder's
  EventManager + ControlRuntimeStore
- Add event namespace prefixes: platform.source.created, feeder.unit.fault_locked, etc.
- Register full platform CRUD routes in ops app

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 13:45:02 +08:00
caoqianming 429c2d0b17 refactor(core): fill PlatformContext with pool/connection/websocket
- PlatformContext now holds pool, connection_manager, ws_manager
- bootstrap_platform returns PlatformBuilder for pre-Arc setup
- Feeder AppState embeds PlatformContext (state.platform.pool etc.)
- Ops AppState embeds PlatformContext with real DB connection
- Remove WebSocket type duplication: feeder re-exports from core
- Add subscribe_room/send_to_room/remove_room_if_empty to WebSocketManager

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 09:11:03 +08:00
caoqianming b651b6af66 refactor(core): move doc handler to core and split API.md per app
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 08:18:51 +08:00
caoqianming 4761e88c81 refactor(core): move log handler to shared platform core
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 13:36:26 +08:00
caoqianming c3037e52cf docs(code): clean garbled rust comments 2026-04-16 15:40:28 +08:00
caoqianming c562bcc10b feat(feeder): create dedicated feeder distributor app crate 2026-04-16 12:38:58 +08:00