portals-project / portals

Portals is a framework for stateful serverless apps, unifying dataflow streaming with actors
https://www.portals-project.org/
Apache License 2.0
19 stars 2 forks source link

Should OnAtomComplete provide atom index and committed index? #115

Closed jspenger closed 1 year ago

jspenger commented 1 year ago

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)?

jspenger commented 1 year ago

Closing this, and moving the discussion to portals-meta.