From 52cd3e630e1743282b45799dd35d2f30d8c158f1 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 22 Apr 2026 08:33:28 +0800 Subject: [PATCH] Rename persist_and_broadcast to record_platform_event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After record_event became the primitive for INSERT + broadcast + tracing, persist_and_broadcast no longer persists or broadcasts directly — it translates a PlatformEvent into an EventInsert and delegates. The new name makes the layering explicit (record_event is the primitive, record_platform_event is the PlatformEvent translator). Co-Authored-By: Claude Opus 4.7 --- crates/plc_platform_core/src/event.rs | 4 ++-- crates/plc_platform_core/src/platform_context.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/plc_platform_core/src/event.rs b/crates/plc_platform_core/src/event.rs index 59ae745..6ac8b5f 100644 --- a/crates/plc_platform_core/src/event.rs +++ b/crates/plc_platform_core/src/event.rs @@ -161,8 +161,8 @@ pub async fn record_event( } } -/// Persists platform events to the `event` table and broadcasts via WebSocket. -pub async fn persist_and_broadcast( +/// Translates a PlatformEvent to an EventInsert and delegates to record_event. +pub async fn record_platform_event( event: &PlatformEvent, pool: &sqlx::PgPool, ws_manager: &WebSocketManager, diff --git a/crates/plc_platform_core/src/platform_context.rs b/crates/plc_platform_core/src/platform_context.rs index 2276ee3..3a28cce 100644 --- a/crates/plc_platform_core/src/platform_context.rs +++ b/crates/plc_platform_core/src/platform_context.rs @@ -35,7 +35,7 @@ impl PlatformContext { let cm = self.connection_manager.clone(); tokio::spawn(async move { // Persist + broadcast. - crate::event::persist_and_broadcast(&event, &pool, &ws_manager).await; + crate::event::record_platform_event(&event, &pool, &ws_manager).await; // Connection management side effects. match &event {