Defines the interface for a container that gathers results from function execution.
More...
#include <ResultCollector.hpp>
Inherited by apache::geode::client::DefaultResultCollector.
|
virtual void | addResult (const std::shared_ptr< Cacheable > &resultOfSingleExecution)=0 |
| Adds a single function execution result to the ResultCollector.
|
|
virtual void | clearResults ()=0 |
| Geode will invoke this method before re-executing function (in case of Function Execution HA) This is to clear the previous execution results from the result collector.
|
|
virtual void | endResults ()=0 |
| Geode will invoke this method when function execution has completed and all results for the execution have been obtained and added to the ResultCollector}.
|
|
virtual std::shared_ptr< CacheableVector > | getResult (std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0 |
| Returns the result of function execution, potentially blocking until all the results are available.
|
|
| ResultCollector ()=default |
| public methods
|
|
Defines the interface for a container that gathers results from function execution.
Geode provides a default implementation for ResultCollector. Applications can choose to implement their own custom ResultCollector. A custom ResultCollector facilitates result sorting or aggregation. Aggregation functions like sum, minimum, maximum and average can also be applied to the result using a custom ResultCollector. Example:
auto rc = FunctionService::onRegion(region)
.withArgs(args)
.withFilter(keySet)
.withCollector(new
MyCustomResultCollector())
.execute(Function);
//Application can do something else here before retrieving the result
auto functionResult = rc.getResult();
- See also
- FunctionService
◆ ResultCollector()
apache::geode::client::ResultCollector::ResultCollector |
( |
| ) |
|
|
default |
◆ addResult()
virtual void apache::geode::client::ResultCollector::addResult |
( |
const std::shared_ptr< Cacheable > & |
resultOfSingleExecution | ) |
|
|
pure virtual |
Adds a single function execution result to the ResultCollector.
- Parameters
-
resultOfSingleExecution | single function execution result to add |
- Since
- 5.8LA
◆ clearResults()
virtual void apache::geode::client::ResultCollector::clearResults |
( |
| ) |
|
|
pure virtual |
Geode will invoke this method before re-executing function (in case of Function Execution HA) This is to clear the previous execution results from the result collector.
- Since
- 6.5
◆ endResults()
virtual void apache::geode::client::ResultCollector::endResults |
( |
| ) |
|
|
pure virtual |
Geode will invoke this method when function execution has completed and all results for the execution have been obtained and added to the ResultCollector}.
◆ getResult()
virtual std::shared_ptr< CacheableVector > apache::geode::client::ResultCollector::getResult |
( |
std::chrono::milliseconds |
timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT | ) |
|
|
pure virtual |
Returns the result of function execution, potentially blocking until all the results are available.
If geode sendException is called then ResultCollector.getResult
will not throw exception but will have exception UserFunctionExecutionException
as a part of results received.
- Parameters
-
timeout | if result is not ready within this time, exception will be thrown |
- Returns
- the result
- Exceptions
-
FunctionException | if result retrieval fails |
- See also
- UserFunctionExecutionException