| 类型 | 契约 |
|---|---|
| EventKind | Send、Receive 两种消息事件 |
| MessageKey | (trace_id, message_id, attempt),可作为 Map 键,重试和不同 trace 相互隔离 |
| SourceLocation | 来源路径与从 1 开始的行号 |
| Event | 事件 ID、时钟 ID、消息键、种类、Int64 微秒时间戳及可选来源 |
| ConstraintOrigin | 消息事件引用,或用户先验的标签 |
| DifferenceConstraint | offset(left_clock) - offset(right_clock) <= upper_bound_us |
| ModelError | 空白标识、负重试索引、非法来源行号 |
let key = @model.MessageKey::new(
trace_id="t1", message_id="request-1", attempt=0,
)
let event = @model.Event::new(
event_id="a1", clock_id="A", key~, kind=@model.Send,
timestamp_us=1000000L,
)
let constraint = @model.DifferenceConstraint::new(
left_clock="A", right_clock="B", upper_bound_us=-100000L,
origin=@model.Message(send_event_id="a1", receive_event_id="b1"),
)#deprecated("`ModelError::equal` is deprecated, use `Eq::equal` instead.")
fn ModelError::equal(ModelError, ModelError) -> Bool#deprecated("`ModelError::not_equal` is deprecated, use `Eq::not_equal` instead.")
fn ModelError::not_equal(x : ModelError, y : ModelError) -> Bool#deprecated("`ModelError::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
fn ModelError::to_repr(ModelError) -> Repr#deprecated("`ConstraintOrigin::equal` is deprecated, use `Eq::equal` instead.")
fn ConstraintOrigin::equal(ConstraintOrigin, ConstraintOrigin) -> Bool#deprecated("`ConstraintOrigin::not_equal` is deprecated, use `Eq::not_equal` instead.")
fn ConstraintOrigin::not_equal(x : ConstraintOrigin, y : ConstraintOrigin) -> Bool#deprecated("`ConstraintOrigin::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
fn ConstraintOrigin::to_repr(ConstraintOrigin) -> Reprpub struct DifferenceConstraint {
left_clock : String
right_clock : String
upper_bound_us : Int64
origin : ConstraintOrigin
} derive(Eq, Debug)#deprecated("`DifferenceConstraint::equal` is deprecated, use `Eq::equal` instead.")
fn DifferenceConstraint::equal(DifferenceConstraint, DifferenceConstraint) -> Boolfn DifferenceConstraint::new(left_clock~ : String, right_clock~ : String, upper_bound_us~ : Int64, origin~ : ConstraintOrigin) -> DifferenceConstraint raise ModelError#deprecated("`DifferenceConstraint::not_equal` is deprecated, use `Eq::not_equal` instead.")
fn DifferenceConstraint::not_equal(x : DifferenceConstraint, y : DifferenceConstraint) -> Bool#deprecated("`DifferenceConstraint::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
fn DifferenceConstraint::to_repr(DifferenceConstraint) -> Reprpub struct Event {
event_id : String
clock_id : String
key : MessageKey
kind : EventKind
timestamp_us : Int64
source : SourceLocation?
} derive(Eq, Debug)fn Event::new(event_id~ : String, clock_id~ : String, key~ : MessageKey, kind~ : EventKind, timestamp_us~ : Int64, source? : SourceLocation) -> Event raise ModelError#deprecated("`MessageKey::equal` is deprecated, use `Eq::equal` instead.")
fn MessageKey::equal(MessageKey, MessageKey) -> Bool#deprecated("`MessageKey::hash` is deprecated, use `Hash::hash` instead.")
fn MessageKey::hash(self : MessageKey) -> Int#deprecated("`MessageKey::hash_combine` is deprecated, use `Hash::hash_combine` instead.")
fn MessageKey::hash_combine(MessageKey, Hasher) -> Unitfn MessageKey::new(trace_id~ : String, message_id~ : String, attempt~ : Int) -> MessageKey raise ModelError#deprecated("`MessageKey::not_equal` is deprecated, use `Eq::not_equal` instead.")
fn MessageKey::not_equal(x : MessageKey, y : MessageKey) -> Bool#deprecated("`MessageKey::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
fn MessageKey::to_repr(MessageKey) -> Repr#deprecated("`SourceLocation::equal` is deprecated, use `Eq::equal` instead.")
fn SourceLocation::equal(SourceLocation, SourceLocation) -> Bool#deprecated("`SourceLocation::not_equal` is deprecated, use `Eq::not_equal` instead.")
fn SourceLocation::not_equal(x : SourceLocation, y : SourceLocation) -> Bool#deprecated("`SourceLocation::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
fn SourceLocation::to_repr(SourceLocation) -> ReprInstall
Download zipOffline clock-offset constraint diagnosis for distributed logs.