@@ -52,15 +52,12 @@ impl TaskContext {
5252 }
5353
5454 // ========================================================================
55- // 水位线与时间流管理 API
5655 // ========================================================================
5756
58- /// 供业务算子调用:获取当前任务的安全水位线
5957 pub fn last_present_watermark ( & self ) -> Option < std:: time:: SystemTime > {
6058 self . current_watermark
6159 }
6260
63- /// 供底座框架 (SubtaskRunner) 调用:推进本地时间,保证单调递增
6461 pub fn advance_watermark ( & mut self , watermark : std:: time:: SystemTime ) {
6562 if let Some ( current) = self . current_watermark {
6663 if watermark > current {
@@ -72,10 +69,8 @@ impl TaskContext {
7269 }
7370
7471 // ========================================================================
75- // 可观测性 API (Observability)
7672 // ========================================================================
7773
78- /// 格式化当前 Task 的唯一标识,用于分布式追踪和日志打印
7974 pub fn task_identity ( & self ) -> String {
8075 format ! (
8176 "Job[{}], Vertex[{}], Subtask[{}/{}]" ,
@@ -84,10 +79,8 @@ impl TaskContext {
8479 }
8580
8681 // ========================================================================
87- // 背压网络发送 API
8882 // ========================================================================
8983
90- /// 受内存池管控的数据发送:申请精准字节的内存船票后广播到所有下游
9184 pub async fn collect ( & self , batch : RecordBatch ) -> anyhow:: Result < ( ) > {
9285 if self . outboxes . is_empty ( ) {
9386 return Ok ( ( ) ) ;
@@ -103,7 +96,6 @@ impl TaskContext {
10396 Ok ( ( ) )
10497 }
10598
106- /// 按 Key 哈希路由到单分区(用于 Shuffle / KeyBy)
10799 pub async fn collect_keyed (
108100 & self ,
109101 key_hash : u64 ,
@@ -122,7 +114,6 @@ impl TaskContext {
122114 Ok ( ( ) )
123115 }
124116
125- /// 广播控制信号(如 Watermark, Barrier:不申请内存船票,保证在拥堵时畅通无阻)
126117 pub async fn broadcast ( & self , event : StreamEvent ) -> anyhow:: Result < ( ) > {
127118 let tracked_event = TrackedEvent :: control ( event) ;
128119 for outbox in & self . outboxes {
0 commit comments