Currently rollups are computed as
departmentEmployeeJoin
.computeSnapshot(id, dateOrVersion)
.flatMap { fromIterator(it.joinedIds) }
.flatMap { employeeQuery.computeSnapshot(it) }
.reduce (new DepartmentSummary()) { rollup, snapshot -> ... }
There isn't much potential to do this additively.
If we can do it differently, and this works, we could try this
departmentEmployeeJoin
.computeSnapshot(id, dateOrVersion)
.flatMap { getAllEventsForAfterDateOrVersion(it.joinedIds, dateOrVersion) }
.reduce (new DepartmentSummary()) {rollup, event -> ... }
The challenge is reducing
- The number of events fetched
- The number of computations performed
- The number of scenarios requiring a full recompute
Currently rollups are computed as
departmentEmployeeJoin .computeSnapshot(id, dateOrVersion) .flatMap { fromIterator(it.joinedIds) } .flatMap { employeeQuery.computeSnapshot(it) } .reduce (new DepartmentSummary()) { rollup, snapshot -> ... }There isn't much potential to do this additively.
If we can do it differently, and this works, we could try this
departmentEmployeeJoin .computeSnapshot(id, dateOrVersion) .flatMap { getAllEventsForAfterDateOrVersion(it.joinedIds, dateOrVersion) } .reduce (new DepartmentSummary()) {rollup, event -> ... }The challenge is reducing