Package io.hekate.messaging.operation
Interface AggregateResult<T>
-
- Type Parameters:
T
- Base type of aggregation results.
- All Superinterfaces:
Iterable<T>
public interface AggregateResult<T> extends Iterable<T>
Result of anAggregate
operation.- See Also:
MessagingChannel.newAggregate(Object)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Throwable
errorOf(ClusterNode node)
Returns an error for the specified node ornull
if there was no failure on that node.Map<ClusterNode,Throwable>
errors()
Returns the map of cluster nodes and errors that happened while trying to communicate with those nodes.default boolean
isSuccess()
Returnstrue
if aggregation completed successfully without anyerrors
.default boolean
isSuccess(ClusterNode node)
Returnstrue
if there was no failure during the aggregation request processing on the specified cluster node.default Iterator<T>
iterator()
List<ClusterNode>
nodes()
Returns the aggregation participants.T
request()
Returns the original request object that was submitted to the cluster.default T
resultOf(ClusterNode node)
Returns the result for the specified cluster node ornull
if there was no result from this node.default Collection<T>
results()
Returns the aggregation results.Map<ClusterNode,T>
resultsByNode()
Returns a map of cluster nodes and results that were successfully received from these nodes.default Stream<T>
stream()
Returns the aggregation results asStream
.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
request
T request()
Returns the original request object that was submitted to the cluster.- Returns:
- Original request.
-
nodes
List<ClusterNode> nodes()
Returns the aggregation participants. Returns an empty list if there were no suitable nodes in the cluster to perform the operation.- Returns:
- Cluster nodes that participated in the aggregation or an empty list if there were no suitable nodes in the cluster to perform the operation.
-
errors
Map<ClusterNode,Throwable> errors()
Returns the map of cluster nodes and errors that happened while trying to communicate with those nodes. Returns an empty map if there were no failures.- Returns:
- Map of nodes and their corresponding failures. Returns an empty map if there were no failures.
- See Also:
errorOf(ClusterNode)
-
resultsByNode
Map<ClusterNode,T> resultsByNode()
Returns a map of cluster nodes and results that were successfully received from these nodes. Returns an empty map if there were no successful results.- Returns:
- Map of results.
- See Also:
resultOf(ClusterNode)
-
resultOf
default T resultOf(ClusterNode node)
Returns the result for the specified cluster node ornull
if there was no result from this node.
-
stream
default Stream<T> stream()
Returns the aggregation results asStream
.- Returns:
- Stream of aggregation results.
-
results
default Collection<T> results()
Returns the aggregation results.- Returns:
- Aggregation results.
-
isSuccess
default boolean isSuccess(ClusterNode node)
Returnstrue
if there was no failure during the aggregation request processing on the specified cluster node.- Parameters:
node
- Cluster node (must be one of thenodes()
).- Returns:
true
if there was no communication failure with the specified cluster node.
-
isSuccess
default boolean isSuccess()
Returnstrue
if aggregation completed successfully without anyerrors
.- Returns:
true
if aggregation completed successfully without any errors.- See Also:
errors()
-
errorOf
default Throwable errorOf(ClusterNode node)
Returns an error for the specified node ornull
if there was no failure on that node.
-
-