Interface LocalPublisherManager<K,V>
- Type Parameters:
K
- The key type for the underlying cacheV
- the value type for the underlying cache
- All Known Implementing Classes:
LocalPublisherManagerImpl
public interface LocalPublisherManager<K,V>
Handles locally publishing entries from the cache. This manager will return results that contains suspected segments
- Since:
- 10.0
- Author:
- wburns
-
Method Summary
Modifier and TypeMethodDescriptionentryPublisher
(IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K, V>>, ? extends org.reactivestreams.Publisher<R>> transformer) Performs the given transformer on data in the cache that is local, resulting in a stream of values of possibly varying size.<R> CompletionStage<org.infinispan.reactive.publisher.impl.commands.reduction.PublisherResult<R>>
entryReduction
(boolean parallelPublisher, IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K, V>>, ? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>, ? extends CompletionStage<R>> finalizer) Performs the given transformer and finalizer on data in the cache that is local, resulting in a single value.keyPublisher
(IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>, ? extends org.reactivestreams.Publisher<R>> transformer) Same asentryPublisher(IntSet, Set, Set, long, DeliveryGuarantee, Function)
except that the source publisher provided to the transformer is made up of keys only.<R> CompletionStage<org.infinispan.reactive.publisher.impl.commands.reduction.PublisherResult<R>>
keyReduction
(boolean parallelPublisher, IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>, ? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>, ? extends CompletionStage<R>> finalizer) Same asentryReduction(boolean, IntSet, Set, Set, long, DeliveryGuarantee, Function, Function)
except that the source publisher provided to the transformer is made up of keys only.void
segmentsLost
(IntSet lostSegments) Method to invoke when a set of segments are being removed from this node.sizePublisher
(IntSet segments, long flags)
-
Method Details
-
keyReduction
<R> CompletionStage<org.infinispan.reactive.publisher.impl.commands.reduction.PublisherResult<R>> keyReduction(boolean parallelPublisher, IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>, ? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>, ? extends CompletionStage<R>> finalizer) Same asentryReduction(boolean, IntSet, Set, Set, long, DeliveryGuarantee, Function, Function)
except that the source publisher provided to the transformer is made up of keys only.- Type Parameters:
R
- return value type- Returns:
- CompletionStage that contains the resulting value when complete
-
entryReduction
<R> CompletionStage<org.infinispan.reactive.publisher.impl.commands.reduction.PublisherResult<R>> entryReduction(boolean parallelPublisher, IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K, V>>, ? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>, ? extends CompletionStage<R>> finalizer) Performs the given transformer and finalizer on data in the cache that is local, resulting in a single value. Depending on the deliveryGuarantee the transformer may be invoked 1..numSegments times. It could be that the transformer is invoked for every segment and produces a result. All of these results are then fed into the finalizer to produce a final result. If publisher is parallel the finalizer will be invoked on each node to ensure there is only a single result per node.The effects of the provided deliveryGuarantee are as follows:
Guarantee Parallel Behavior> AT_MOST_ONCE TRUE Each segment is a publisher passed to the transformer individually. Each result of the transformer is supplied to the finalizer. All segments are always complete, ignoring loss of data AT_MOST_ONCE FALSE A single publisher for all segments is created and passed to the transformer. That result is returned, finalizer is never used All segments are always complete, ignoring loss of data AT_LEAST_ONCE TRUE Same as AT_MOST_ONCE, but if a segment is lost in the middle it is returned as a suspected segment always returning all values AT_LEAST_ONCE FALSE Same as AT_MOST_ONCE, but if a segment is lost in the middle it is returned as a suspected segment always returning all values EXACTLY_ONCE TRUE Each segment is a publisher passed to the transformer individually. Each result is only accepted if the segment was owned the entire duration of the Subscription. EXACTLY_ONCE FALSE Same as EXACTLY_ONCE/TRUE, except the publishers are consumed one at a time. - Type Parameters:
R
- return value type- Parameters:
parallelPublisher
- Whether the publisher should be parallelizedsegments
- determines what entries should be evaluated by only using ones that map to the given segments (must not be null)keysToInclude
- set of keys that should only be used. May be null, in which case all provided entries for the given segments will be evaluatedkeysToExclude
- set of keys that should not be used. May be null, in which case all provided entries will be evaluatedexplicitFlags
- cache flagsdeliveryGuarantee
- delivery guarantee for given entriestransformer
- reduces the given publisher of data eventually into a single value. Must not be null.finalizer
- reduces all of the single values produced by the transformer or this finalizer into one final value. May be null if not parallel- Returns:
- CompletionStage that contains the resulting value when complete
-
keyPublisher
<R> SegmentAwarePublisherSupplier<R> keyPublisher(IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>, ? extends org.reactivestreams.Publisher<R>> transformer) Same asentryPublisher(IntSet, Set, Set, long, DeliveryGuarantee, Function)
except that the source publisher provided to the transformer is made up of keys only.- Type Parameters:
R
- return value type- Returns:
- SegmentAwarePublisher that will publish the values when subscribed to along with segment completions and losses
-
entryPublisher
<R> SegmentAwarePublisherSupplier<R> entryPublisher(IntSet segments, Set<K> keysToInclude, Set<K> keysToExclude, long explicitFlags, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K, V>>, ? extends org.reactivestreams.Publisher<R>> transformer) Performs the given transformer on data in the cache that is local, resulting in a stream of values of possibly varying size. The transformer will be invoked numSegments times. The table below shows the behavior for the various delivery guarantees.The effects of the provided deliveryGuarantee are as follows:
Guarantee Behavior> AT_MOST_ONCE For each segment a publisher passed to the transformer sequentially. All segments are always complete, ignoring loss of data AT_LEAST_ONCE Same as AT_MOST_ONCE, but if a segment is lost in the middle it is returned as a suspected segment possibly dropping values in that segment. EXACTLY_ONCE Same as AT_LEAST_ONCE except whenever as segment is lost the value(s) collected in the same response for that segment are always dropped. The returned publisher supplier method
SegmentAwarePublisherSupplier.publisherWithLostSegments()
will guarantee that all entries from a given segment are returned first proceeded by a segment lost or completed notification. This publisher will not intermingle entries from different segment together. This guarantee should allow for callers to be able to optimize knowing this since segments can be completed quicker and fewer entries should have to be retained in memory.- Type Parameters:
R
- return value type- Parameters:
segments
- determines what entries should be evaluated by only using ones that map to the given segments (must not be null)keysToInclude
- set of keys that should only be used. May be null, in which case all provided entries for the given segments will be evaluatedkeysToExclude
- set of keys that should not be used. May be null, in which case all provided entries will be evaluatedexplicitFlags
- cache flagsdeliveryGuarantee
- delivery guarantee for given entriestransformer
- transforms the values to another value (0 to many). Must not be null.- Returns:
- SegmentAwarePublisher that will publish the values when subscribed to along with segment completions and losses
-
segmentsLost
Method to invoke when a set of segments are being removed from this node. This way operations can be aware of possible data loss while processing.- Parameters:
lostSegments
- the segments that are being removed from this node
-
sizePublisher
-