// v0 hello-world: a Timer source actor emits Tick molecules every 100ms,
// and a CountTicks reaction increments a singleton Counter via merge.
// Initial state (the Timer config) is emitted by an Init reaction over Boot.
molecule Tick {
sequence: Int
ts: Timestamp
primary_key: sequence
}
molecule Counter {
value: Int { default: 0 }
ts: Timestamp
primary_key: ()
merge: |old, new| Counter { value: old.value + 1, ts: now() }
}
reaction CountTicks {
when: Tick(t)
emit: Counter { value: 1, ts: t.ts }
}
reaction Init {
when: Boot(b)
emit: Timer { interval: 100ms }
}