All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.CacheCollection Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan;

import org.infinispan.commons.util.CloseableIteratorCollection;
import org.infinispan.commons.util.Experimental;
import org.infinispan.commons.util.IntSet;
import org.infinispan.commons.util.IntSets;
import org.reactivestreams.Publisher;

import io.reactivex.rxjava3.core.Flowable;

/**
 * A collection type that returns special Cache based streams that have additional options to tweak behavior.
 * @param  The type of the collection
 * @since 8.0
 */
public interface CacheCollection extends CloseableIteratorCollection {
   @Override
   CacheStream stream();

   @Override
   CacheStream parallelStream();

   /**
    * Returns a publisher that will publish all elements that map to the given segment. Note this publisher may
    * require going remotely to retrieve elements depending on the underlying configuration and flags applied
    * to the original Cache used to create this CacheCollection.
    * @param segment the segment that all published elements belong to
    * @return Publisher that will publish the elements for the given segment
    * @implSpec Default implementation just does:
    * 
 {@code
    * return localPublisher(org.infinispan.commons.util.IntSets.immutableSet(segment));
    * }
*/ @Experimental default Publisher localPublisher(int segment) { return localPublisher(IntSets.immutableSet(segment)); } /** * Returns a publisher that will publish all elements that map to the given segment. Note this publisher may * require going remotely to retrieve elements depending on the underlying configuration and flags applied * to the original Cache used to create this CacheCollection. * @param segments the segments that all published elements belong to * @return Publisher that will publish the elements for the given segments * @implSpec Default implementation falls back to stream filtering out the given segments *
 {@code
    * return io.reactivex.Flowable.fromIterable(() -> stream().filterKeySegments(segments).iterator());
    * }
*/ @Experimental default Publisher localPublisher(IntSet segments) { return Flowable.fromStream(stream().filterKeySegments(segments)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy