Skip to content

Commit 18a19f1

Browse files
committed
update
1 parent 5b596f2 commit 18a19f1

69 files changed

Lines changed: 1 addition & 295 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/runtime/streaming/api/context.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

src/runtime/streaming/api/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! 接口层:算子与源实现需遵循的 trait 与运行时上下文。
1413

1514
pub mod context;
1615
pub mod operator;

src/runtime/streaming/api/operator.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ use crate::sql::common::{CheckpointBarrier, Watermark};
2222
// ConstructedOperator
2323
// ---------------------------------------------------------------------------
2424

25-
/// 工厂反射产出的具体算子实例
2625
pub enum ConstructedOperator {
2726
Source(Box<dyn SourceOperator>),
2827
Operator(Box<dyn MessageOperator>),
2928
}
3029

31-
/// 多上游、被动驱动的消息算子。
3230
#[async_trait]
3331
pub trait MessageOperator: Send + 'static {
3432
fn name(&self) -> &str;
@@ -37,7 +35,6 @@ pub trait MessageOperator: Send + 'static {
3735
Ok(())
3836
}
3937

40-
/// `input_idx`:多输入拓扑下第几条边(与 `SubtaskRunner` 的 inbox 下标一致;单输入恒为 0)。
4138
async fn process_data(
4239
&mut self,
4340
input_idx: usize,
@@ -57,7 +54,6 @@ pub trait MessageOperator: Send + 'static {
5754
ctx: &mut TaskContext,
5855
) -> anyhow::Result<()>;
5956

60-
/// 全局 checkpoint 确认后由 `SubtaskRunner` 在 [`ControlCommand::Commit`] 上调用(如 Kafka EOS 二阶段提交)。
6157
async fn commit_checkpoint(
6258
&mut self,
6359
_epoch: u32,
@@ -66,12 +62,10 @@ pub trait MessageOperator: Send + 'static {
6662
Ok(())
6763
}
6864

69-
/// 周期性时钟(如 Idle 检测);`None` 表示不注册 tick。
7065
fn tick_interval(&self) -> Option<Duration> {
7166
None
7267
}
7368

74-
/// 与 [`Self::tick_interval`] 配套,由 `SubtaskRunner` 按固定间隔调用。
7569
async fn process_tick(
7670
&mut self,
7771
_tick_index: u64,

src/runtime/streaming/api/source.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! 源算子:由 [`crate::runtime::streaming::execution::SourceRunner`] 驱动 `fetch_next`,不得在内部死循环阻塞控制面。
1413

1514
use crate::runtime::streaming::api::context::TaskContext;
1615
use arrow_array::RecordBatch;
1716
use async_trait::async_trait;
1817
use crate::sql::common::{CheckpointBarrier, Watermark};
1918

20-
/// Kafka 等外部源在 **无已存位点** 时的起始消费策略(与 `arroyo-connectors` 语义对齐)。
2119
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
2220
pub enum SourceOffset {
2321
Earliest,
@@ -30,7 +28,6 @@ pub enum SourceOffset {
3028
pub enum SourceEvent {
3129
Data(RecordBatch),
3230
Watermark(Watermark),
33-
/// 无数据可读:必须由 Runner 调度退避,禁止在 `fetch_next` 内长时间阻塞。
3431
Idle,
3532
EndOfStream,
3633
}
@@ -43,10 +40,8 @@ pub trait SourceOperator: Send + 'static {
4340
Ok(())
4441
}
4542

46-
/// 核心拉取:无数据时必须返回 [`SourceEvent::Idle`],严禁内部阻塞控制面。
4743
async fn fetch_next(&mut self, ctx: &mut TaskContext) -> anyhow::Result<SourceEvent>;
4844

49-
/// 独立于 `fetch_next` 的水位线脉搏(例如解决 Idle 时仍要推进水印)。
5045
fn poll_watermark(&mut self) -> Option<Watermark> {
5146
None
5247
}

src/runtime/streaming/error.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,33 @@
1313
use std::fmt::Display;
1414
use thiserror::Error;
1515

16-
/// 流水线 / 子任务运行期间的错误定义。
1716
#[derive(Debug, Error)]
1817
pub enum RunError {
19-
/// 算子内部业务逻辑抛出的错误
2018
#[error("Operator execution failed: {0:#}")]
2119
Operator(#[from] anyhow::Error),
2220

23-
/// 向下游 Task 发送数据/信号时通道阻塞或断开
2421
#[error("Downstream send failed: {0}")]
2522
DownstreamSend(String),
2623

27-
/// 引擎内部状态机错误或拓扑规划错误(如:DAG 为空、在链条中间发生 Shuffle)
2824
#[error("Internal engine error: {0}")]
2925
Internal(String),
3026

31-
/// Checkpoint 状态持久化或恢复时发生的错误
3227
#[error("State backend error: {0}")]
3328
State(String),
3429

35-
/// 底层网络或文件 I/O 错误
3630
#[error("I/O error: {0}")]
3731
Io(#[from] std::io::Error),
3832
}
3933

4034
impl RunError {
41-
/// 快捷构造器:引擎内部错误(常用于防御性编程和边界校验)
4235
pub fn internal<T: Display>(msg: T) -> Self {
4336
Self::Internal(msg.to_string())
4437
}
4538

46-
/// 快捷构造器:下游发送异常
4739
pub fn downstream<T: Display>(msg: T) -> Self {
4840
Self::DownstreamSend(msg.to_string())
4941
}
5042

51-
/// 快捷构造器:状态后端异常
5243
pub fn state<T: Display>(msg: T) -> Self {
5344
Self::State(msg.to_string())
5445
}

src/runtime/streaming/execution/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! 执行层:Tokio Actor 运行容器。
1413

1514
pub mod runner;
1615
pub mod source;

src/runtime/streaming/execution/runner.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use crate::runtime::streaming::execution::tracker::{
3232
use crate::sql::common::{CheckpointBarrier, Watermark};
3333

3434
// ==========================================
35-
// 第一部分:逻辑处理层 - 算子融合链 (Logical Driver)
3635
// ==========================================
3736

3837
#[async_trait]
@@ -62,7 +61,6 @@ impl ChainedDriver {
6261
Self { operator, next }
6362
}
6463

65-
/// 从后往前组装算子,构建责任链
6664
pub fn build_chain(mut operators: Vec<Box<dyn MessageOperator>>) -> Option<Box<dyn OperatorDrive>> {
6765
if operators.is_empty() {
6866
return None;
@@ -227,7 +225,6 @@ impl OperatorDrive for ChainedDriver {
227225
}
228226

229227
// ==========================================
230-
// 第二部分:物理执行层 - 流水线 (Physical Driver)
231228
// ==========================================
232229

233230
pub struct Pipeline {
@@ -238,7 +235,6 @@ pub struct Pipeline {
238235

239236
wm_tracker: WatermarkTracker,
240237
barrier_aligner: BarrierAligner,
241-
/// Barrier 未对齐时从轮询池移除的输入流(背压)
242238
paused_streams: Vec<Option<BoxedEventStream>>,
243239
}
244240

@@ -376,5 +372,4 @@ impl Pipeline {
376372
}
377373
}
378374

379-
/// 与执行引擎语义对齐的别名
380375
pub type SubtaskRunner = Pipeline;

src/runtime/streaming/execution/source.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! 源任务物理驱动:控制面优先、`fetch_next` 非阻塞契约、可选融合算子链下推。
1413

1514
use crate::runtime::streaming::api::context::TaskContext;
1615
use crate::runtime::streaming::api::source::{SourceEvent, SourceOperator};
@@ -30,7 +29,6 @@ pub const WATERMARK_EMIT_INTERVAL: Duration = Duration::from_millis(200);
3029

3130
pub struct SourceRunner {
3231
operator: Box<dyn SourceOperator>,
33-
/// 有链时数据与信号经链尾再 `collect` / `broadcast`;无链则直接走 `TaskContext`。
3432
chain_head: Option<Box<dyn OperatorDrive>>,
3533
ctx: TaskContext,
3634
control_rx: Receiver<ControlCommand>,

src/runtime/streaming/execution/tracker/barrier_aligner.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! Chandy–Lamport 风格屏障对齐(零内存缓冲:未对齐时从轮询池移除输入流,依赖底层背压)。
1413

1514
use std::collections::HashSet;
1615

1716
use crate::sql::common::CheckpointBarrier;
1817

1918
#[derive(Debug)]
2019
pub enum AlignmentStatus {
21-
/// 未对齐:外层应将当前通道从 `StreamMap` 挂起(Pause)。
2220
Pending,
23-
/// 已对齐:外层触发快照并唤醒所有挂起通道(Resume)。
2421
Complete,
2522
}
2623

src/runtime/streaming/execution/tracker/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// See the License for the specific language governing permissions and
1111
// limitations under the License.
1212

13-
//! 协调层:屏障对齐与多路水位线追踪。
1413

1514
pub mod barrier_aligner;
1615
pub mod watermark_tracker;

0 commit comments

Comments
 (0)