tg icon indicating copy to clipboard operation
tg copied to clipboard

Continuations: initialisation with an instance (as opposed to a type)

Open 01es opened this issue 1 year ago • 0 comments

Description

Continuation is initiated by throwing an exception of type NeedMoreData that is initialised with a type of an action-entity, representing that continuation. This happens in method save for an entity that requires more data before it can be saved. The actual instantiation and initialisation of a continuation of the specified type happens elsewhere. Custom initialisation can happen in a producer, defined for a continuation. However, the producer does not have a context in which the need for continuation was identified. This makes it difficult and cumbersome to pass some state around if a continuation instance should be initialised based on the data, available in save at the time NeedMoreData in thrown.

  • [x] 1. API change: NeedMoreData needs to be modified to support passing a continuation instance.

  • [ ] 2. Internal mechanics change: if a continuation instance is provided in NeedMoreData as opposed to a continuation type, this instance should be maintained instead of creating a new one; this includes passing this instance into a producer, if such producer exists.

Expected outcome

A way to initiate a continuation with an instance rather than just a type of continuation.

01es avatar Jun 27 '24 09:06 01es