[
https://issues.apache.org/jira/browse/IGNITE-16543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504227#comment-17504227
]
Vladislav Pyatkov commented on IGNITE-16543:
--------------------------------------------
LGTM
> Implement an #update method for VersionedValue
> ----------------------------------------------
>
> Key: IGNITE-16543
> URL: https://issues.apache.org/jira/browse/IGNITE-16543
> Project: Ignite
> Issue Type: Improvement
> Reporter: Denis Chudov
> Assignee: Denis Chudov
> Priority: Major
> Labels: ignite-3
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Implement an update(long causalityToken, BiFunction<T, Throwable, T> updater)
> method for VersionedValue. It is necessary to be able to call one listener
> (especially listenElements listeners) multiple times on the same causality
> token.
> Description:
> Updates the value on the given causality token using the given updater. The
> updater receives the value on previous token, or \{@link Throwable} if
> exception or error was thrown, or default value (see constructor) if the
> value isn't initialized, or current intermediate value; and returns a new
> value.
> This method can be called multiple times for the same token, and doesn't
> complete the future created for this token. The future is supposed to be
> completed by storage revision update in this case. If this method has been
> called at least once on the given token, the updater will receive a value
> that was evaluated by updater on previous call, as intermediate result.
> As the order of multiple calls of this method on the same token is unknown,
> operations done by the updater must be commutative.
> For example, this method was called for token N-1 and updater evaluated the
> value V1. Then a storage revision update happened. Then, this method is
> called for token N, updater receives V1 and evaluates V2. After that, this
> method is called once again for token N, then the updater receives V2 as
> intermediate result and evaluates V3. Then storage revision update happens
> and the future for token N completes with value V3. Regardless of order in
> which this method's calls are made, V3 should be the final result.
> The method should return previous value.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)