It is an interesting idea to have the onAtomComplete method to provide both the current atom index (the sequence number of the atom) and the committed index (until what sequence number has it been committed). It would enable the application to be aware of what has been committted so far. This information could be used in order to interact with the environment (which still may not be safe). Another option, besides having this information in the onAtomComplete handler, is to have it as part of the task context.
Example, simplified, but hopefully gets the point across
TaskBuilder.processor { ctx ?=> x =>
environment.call(x, ctx.atomIdx) // pre-commit x
environment.commitUntil(ctx.committedIdx) // commit all up to committedIdx
}
To discuss: is this something which we think is worth integrating into Portals? and, if yes, should this be part of the onAtomComplete method or should it be part of the Context (as in the example)?
It is an interesting idea to have the onAtomComplete method to provide both the current atom index (the sequence number of the atom) and the committed index (until what sequence number has it been committed). It would enable the application to be aware of what has been committted so far. This information could be used in order to interact with the environment (which still may not be safe). Another option, besides having this information in the onAtomComplete handler, is to have it as part of the task context.
Example, simplified, but hopefully gets the point across
To discuss: is this something which we think is worth integrating into Portals? and, if yes, should this be part of the onAtomComplete method or should it be part of the Context (as in the example)?