Currently the only way to have state in a stateful grain that isn't persisted when returning save from a callback is to keep both states in a map:
#{persistent => PState,
ephemeral => EState}
This may be a bit clunky. A tuple like {PState, EState} is an option, but prone to mistakes. Expanding the return options to support like, {save_reply, ok, EState, PState}, is also error prone, while the addition of the 4-tuple option also complicates the callback handler in erleans_grain, so {save_reply, ok, {e, EState}, {p, PState} would help against being error prone but still complicates the handlers.
Anyway, just some thoughts.
Currently the only way to have state in a stateful grain that isn't persisted when returning
savefrom a callback is to keep both states in a map:This may be a bit clunky. A tuple like
{PState, EState}is an option, but prone to mistakes. Expanding the return options to support like,{save_reply, ok, EState, PState}, is also error prone, while the addition of the 4-tuple option also complicates the callback handler inerleans_grain, so{save_reply, ok, {e, EState}, {p, PState}would help against being error prone but still complicates the handlers.Anyway, just some thoughts.