38 lines
554 B
Text
38 lines
554 B
Text
|
|
actor accumulator {
|
||
|
|
state {
|
||
|
|
total: u64 = 0
|
||
|
|
}
|
||
|
|
|
||
|
|
window total_view : (total)
|
||
|
|
readers(observe)
|
||
|
|
|
||
|
|
on Add(value: u64) {
|
||
|
|
total = total + value
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
leaf source {
|
||
|
|
process {
|
||
|
|
forward(accumulator, Add(10))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
leaf observe {
|
||
|
|
reads accumulator.total_view
|
||
|
|
process {
|
||
|
|
read(accumulator.total_view.total)
|
||
|
|
emit(total)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
pipeline main {
|
||
|
|
source -> accumulator -> observe
|
||
|
|
}
|
||
|
|
|
||
|
|
core main {
|
||
|
|
actors: [accumulator]
|
||
|
|
leaves: [source, observe]
|
||
|
|
pipelines: [main]
|
||
|
|
steps: 3
|
||
|
|
}
|