目录

MoonWatermarkKit

MoonWatermarkKit is a zero-dependency MoonBit decision core for event-time watermarks, late-event classification, and tumbling or sliding-window assignment. It is designed to be embedded in telemetry ingestion, log analysis, metrics, and IoT pipelines; it is not a broker, storage engine, or distributed stream runtime.

Install

moon add Oyc996/moonwatermarkkit

Minimal use

import { "Oyc996/moonwatermarkkit" @watermark }

let policy = @watermark.WatermarkPolicy::new(10_000, 30_000, 60_000)
let state = @watermark.WatermarkState::new(policy).observe(
  @watermark.StreamEvent::new("sensor-a", 120_000, 1, 42),
)
let assignment = @watermark.assign_event(
  state,
  @watermark.minute_window(),
  @watermark.StreamEvent::new("sensor-a", 115_000, 2, 7),
)
println(assignment.status.name()) // "late"

observe advances a monotonic watermark using the maximum observed event time. assign_event classifies a record as on_time, late, or too_late and returns every matching window. Applications retain ownership of persistence, networking, checkpointing, and window storage.

Verify and run

moon fmt --check
moon info && git diff --exit-code -- '*.mbti'
moon check --target all
moon build --target all
moon test --target all
moon run cmd/main

The CLI prints a reproducible two-event example and its JSON audit summary. See README.mbt.md for the API overview and docs/ACCEPTANCE.md for the implemented boundary.

关于
313.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号