Interface LocalPublisherManager<K,​V>

  • Type Parameters:
    K - The key type for the underlying cache
    V - the value type for the underlying cache
    All Known Implementing Classes:
    LocalPublisherManagerImpl, NonSegmentedLocalPublisherManagerImpl

    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 Detail

      • entryReduction

        <R> CompletionStage<PublisherResult<R>> entryReduction​(boolean parallelPublisher,
                                                               org.infinispan.commons.util.IntSet segments,
                                                               Set<K> keysToInclude,
                                                               Set<K> keysToExclude,
                                                               boolean includeLoader,
                                                               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:

        GuaranteeParallelBehavior>
        AT_MOST_ONCE TRUEEach 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 FALSEA 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 TRUESame 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 FALSESame 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 TRUEEach 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 FALSESame 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 parallelized
        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 evaluated
        keysToExclude - set of keys that should not be used. May be null, in which case all provided entries will be evaluated
        includeLoader - whether to include entries from the underlying cache loader if any
        deliveryGuarantee - delivery guarantee for given entries
        transformer - 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> SegmentAwarePublisher<R> keyPublisher​(org.infinispan.commons.util.IntSet segments,
                                                  Set<K> keysToInclude,
                                                  Set<K> keysToExclude,
                                                  boolean includeLoader,
                                                  DeliveryGuarantee deliveryGuarantee,
                                                  Function<? super org.reactivestreams.Publisher<K>,​? extends org.reactivestreams.Publisher<R>> transformer)
        Same as entryPublisher(IntSet, Set, Set, boolean, 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> SegmentAwarePublisher<R> entryPublisher​(org.infinispan.commons.util.IntSet segments,
                                                    Set<K> keysToInclude,
                                                    Set<K> keysToExclude,
                                                    boolean includeLoader,
                                                    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:

        GuaranteeBehavior>
        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.
        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 evaluated
        keysToExclude - set of keys that should not be used. May be null, in which case all provided entries will be evaluated
        includeLoader - whether to include entries from the underlying cache loader if any
        deliveryGuarantee - delivery guarantee for given entries
        transformer - 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

        void segmentsLost​(org.infinispan.commons.util.IntSet lostSegments)
        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