Package org.infinispan.stream.impl
Interface ClusterStreamManager<Original,K>
-
- Type Parameters:
K
- The key type for the underlying cache
- All Known Implementing Classes:
ClusterStreamManagerImpl
,PartitionAwareClusterStreamManager
public interface ClusterStreamManager<Original,K>
Manages distribution of various stream operations that are sent to remote nodes. Note usage of any operations should always be accompanied with a subsequent call toforgetOperation(Object)
so that the operation is fully released. This is important especially for early terminating operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ClusterStreamManager.RemoteIteratorPublisher<K>
static interface
ClusterStreamManager.ResultsCallback<R>
A callback that is used for result processing from the remote nodes.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
awaitCompletion(Object id, long time, TimeUnit unit)
Awaits completion of the given request.void
forgetOperation(Object id)
Frees any resources related to this operation and signals to any ongoing remote operations to no longer continue processingboolean
isComplete(Object id)
Tests whether this operation is still pending or not.<R1> boolean
receiveResponse(Object id, Address origin, boolean complete, org.infinispan.commons.util.IntSet segments, R1 response)
Receives a response for a given request<E> ClusterStreamManager.RemoteIteratorPublisher<E>
remoteIterationPublisher(boolean parallelStream, Supplier<Map.Entry<Address,org.infinispan.commons.util.IntSet>> segments, Set<K> keysToInclude, IntFunction<Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, Iterable<org.infinispan.stream.impl.intops.IntermediateOperation> intermediateOperations)
<R> Object
remoteStreamOperation(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, KeyTrackingTerminalOperation<Original,K,R> operation, ClusterStreamManager.ResultsCallback<Collection<R>> callback)
Key tracking remote operation that doesn't have rehash enabled.<R> Object
remoteStreamOperation(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, TerminalOperation<Original,R> operation, ClusterStreamManager.ResultsCallback<R> callback, Predicate<? super R> earlyTerminatePredicate)
Performs the remote stream operation without rehash awareness.Object
remoteStreamOperationRehashAware(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, KeyTrackingTerminalOperation<Original,K,?> operation, ClusterStreamManager.ResultsCallback<Collection<K>> callback)
Key tracking remote operation that has rehash enabled<R> Object
remoteStreamOperationRehashAware(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, TerminalOperation<Original,R> operation, ClusterStreamManager.ResultsCallback<R> callback, Predicate<? super R> earlyTerminatePredicate)
Performs the remote stream operation with rehash awareness.
-
-
-
Method Detail
-
remoteStreamOperation
<R> Object remoteStreamOperation(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, TerminalOperation<Original,R> operation, ClusterStreamManager.ResultsCallback<R> callback, Predicate<? super R> earlyTerminatePredicate)
Performs the remote stream operation without rehash awareness.- Type Parameters:
R
- the type of response- Parameters:
parallelDistribution
- whether or not parallel distribution is enabledparallelStream
- whether or not the stream is paralllelch
- the consistent hash to use when determining segment ownershipsegments
- the segments that this request should utilizekeysToInclude
- which keys to include in the requestkeysToExclude
- which keys to exclude in the requestincludeLoader
- whether or not to use a loaderentryStream
- whether the remote stream should be an entry or key streamoperation
- the actual operation to performcallback
- the callback to collect individual node resultsearlyTerminatePredicate
- a predicate to determine if this operation should stop based on intermediate results- Returns:
- the operation id to be used for further calls
-
remoteStreamOperationRehashAware
<R> Object remoteStreamOperationRehashAware(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, TerminalOperation<Original,R> operation, ClusterStreamManager.ResultsCallback<R> callback, Predicate<? super R> earlyTerminatePredicate)
Performs the remote stream operation with rehash awareness.- Type Parameters:
R
- the type of response- Parameters:
parallelDistribution
- whether or not parallel distribution is enabledparallelStream
- whether or not the stream is paralllelch
- the consistent hash to use when determining segment ownershipsegments
- the segments that this request should utilizekeysToInclude
- which keys to include in the requestkeysToExclude
- which keys to exclude in the requestincludeLoader
- whether or not to use a loaderentryStream
- whether the remote stream should be an entry or key streamoperation
- the actual operation to performcallback
- the callback to collect individual node resultsearlyTerminatePredicate
- a predicate to determine if this operation should stop based on intermediate results- Returns:
- the operation id to be used for further calls
-
remoteStreamOperation
<R> Object remoteStreamOperation(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, KeyTrackingTerminalOperation<Original,K,R> operation, ClusterStreamManager.ResultsCallback<Collection<R>> callback)
Key tracking remote operation that doesn't have rehash enabled.- Type Parameters:
R
- the type of response- Parameters:
parallelDistribution
- whether or not parallel distribution is enabledparallelStream
- whether or not the stream is paralllelch
- the consistent hash to use when determining segment ownershipsegments
- the segments that this request should utilizekeysToInclude
- which keys to include in the requestkeysToExclude
- which keys to exclude in the requestincludeLoader
- whether or not to use a loaderentryStream
- whether the remote stream should be an entry or key streamoperation
- the actual operation to performcallback
- the callback to collect individual node results- Returns:
- the operation id to be used for further calls
-
remoteStreamOperationRehashAware
Object remoteStreamOperationRehashAware(boolean parallelDistribution, boolean parallelStream, ConsistentHash ch, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, Map<Integer,Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, KeyTrackingTerminalOperation<Original,K,?> operation, ClusterStreamManager.ResultsCallback<Collection<K>> callback)
Key tracking remote operation that has rehash enabled- Parameters:
parallelDistribution
- whether or not parallel distribution is enabledparallelStream
- whether or not the stream is paralllelch
- the consistent hash to use when determining segment ownershipsegments
- the segments that this request should utilizekeysToInclude
- which keys to include in the requestkeysToExclude
- which keys to exclude in the requestincludeLoader
- whether or not to use a loaderentryStream
- whether the remote stream should be an entry or key streamoperation
- the actual operation to performcallback
- the callback to collect individual node results- Returns:
- the operation id to be used for further calls
-
isComplete
boolean isComplete(Object id)
Tests whether this operation is still pending or not.- Parameters:
id
- the id of the operation that was returned from the invocation- Returns:
- whether or not it is completed
-
awaitCompletion
boolean awaitCompletion(Object id, long time, TimeUnit unit) throws InterruptedException
Awaits completion of the given request. Returns true when the request completes otherwise returns false after the time elapses- Parameters:
id
- the ide of the operation that was returned from the invocation - must be non nulltime
- how long to wait before returning false - must be greater than 0unit
- controls how long the time wait is- Returns:
- whether or not the request is complete
- Throws:
InterruptedException
-
forgetOperation
void forgetOperation(Object id)
Frees any resources related to this operation and signals to any ongoing remote operations to no longer continue processing- Parameters:
id
- the ide of the operation that was returned from the invocation - can be null in which case this is a noop
-
receiveResponse
<R1> boolean receiveResponse(Object id, Address origin, boolean complete, org.infinispan.commons.util.IntSet segments, R1 response)
Receives a response for a given request- Type Parameters:
R1
- The type of the response- Parameters:
id
- The request idorigin
- The origin of the responsecomplete
- Whether or not this is a completed responsesegments
- The segments that were suspectedresponse
- The actual response value- Returns:
- Whether or not the operation should continue operating, only valid if complete was false
-
remoteIterationPublisher
<E> ClusterStreamManager.RemoteIteratorPublisher<E> remoteIterationPublisher(boolean parallelStream, Supplier<Map.Entry<Address,org.infinispan.commons.util.IntSet>> segments, Set<K> keysToInclude, IntFunction<Set<K>> keysToExclude, boolean includeLoader, boolean entryStream, Iterable<org.infinispan.stream.impl.intops.IntermediateOperation> intermediateOperations)
- Type Parameters:
E
-- Parameters:
parallelStream
-segments
-keysToInclude
-keysToExclude
-includeLoader
-entryStream
- whether the remote stream should be an entry or key streamintermediateOperations
-- Returns:
-
-