Package org.infinispan.persistence.spi
Interface AdvancedCacheLoader<K,V>
-
- All Superinterfaces:
CacheLoader<K,V>,Lifecycle
- All Known Subinterfaces:
AdvancedLoadWriteStore<K,V>,SegmentedAdvancedLoadWriteStore<K,V>
- All Known Implementing Classes:
AbstractSegmentedAdvancedLoadWriteStore,AdvancedAsyncCacheLoader,ComposedSegmentedLoadWriteStore,JdbcStringBasedStore,JpaStore,RemoteStore,RestStore,RocksDBStore,SingleFileStore,SoftIndexFileStore
@ThreadSafe public interface AdvancedCacheLoader<K,V> extends CacheLoader<K,V>
A specialised extension of theCacheLoaderinterface that allows processing parallel iteration over the existing entries.- Since:
- 6.0
- Author:
- Mircea Markus
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceAdvancedCacheLoader.CacheLoaderTask<K,V>Deprecated.since 9.3 The process method is deprecated and thus this class shouldn't be in use any morestatic interfaceAdvancedCacheLoader.TaskContextDeprecated.since 9.3 The process method is no longer suggested and thus this class shouldn't be in use any more
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default org.reactivestreams.Publisher<MarshallableEntry<K,V>>entryPublisher(java.util.function.Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)Publishes all entries from this store.default voidprocess(KeyFilter<? super K> filter, AdvancedCacheLoader.CacheLoaderTask<K,V> task, java.util.concurrent.Executor executor, boolean fetchValue, boolean fetchMetadata)Deprecated.since 9.3 This is to be removed and replaced bypublishEntries(Predicate, boolean, boolean)default org.reactivestreams.Publisher<MarshalledEntry<K,V>>publishEntries(java.util.function.Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)Deprecated.since 10.0, please usentryPublisher(Predicate, boolean, boolean)instead.default org.reactivestreams.Publisher<K>publishKeys(java.util.function.Predicate<? super K> filter)Publishes all the keys from this store.intsize()Returns the number of elements in the store.-
Methods inherited from interface org.infinispan.persistence.spi.CacheLoader
contains, init, isAvailable, load, loadEntry
-
-
-
-
Method Detail
-
process
@Deprecated default void process(KeyFilter<? super K> filter, AdvancedCacheLoader.CacheLoaderTask<K,V> task, java.util.concurrent.Executor executor, boolean fetchValue, boolean fetchMetadata)
Deprecated.since 9.3 This is to be removed and replaced bypublishEntries(Predicate, boolean, boolean)Iterates in parallel over the entries in the storage using the threads from the executor pool. For each entry theAdvancedCacheLoader.CacheLoaderTask.processEntry(MarshalledEntry, TaskContext)is invoked. Before passing an entry to the callback task, the entry should be validated against the filter. Implementors should build anAdvancedCacheLoader.TaskContextinstance (implementation) that is fed to theAdvancedCacheLoader.CacheLoaderTaskon every invocation. TheAdvancedCacheLoader.CacheLoaderTaskmight invokeAdvancedCacheLoader.TaskContext.stop()at any time, so implementors of this method should verify TaskContext's state for early termination of iteration. The method should only return once the iteration is complete or as soon as possible in the case TaskContext.stop() is invoked.- Parameters:
filter- to validate which entries should be feed into the task. Might be null.task- callback to be invoked in parallel for each stored entry that passes the filter checkexecutor- an external thread pool to be used for parallel iterationfetchValue- whether or not to fetch the value from the persistent store. E.g. if the iteration is intended only over the key set, no point fetching the values from the persistent store as wellfetchMetadata- whether or not to fetch the metadata from the persistent store. E.g. if the iteration is intended only ove the key set, then no pint fetching the metadata from the persistent store as well- Throws:
PersistenceException- in case of an error, e.g. communicating with the external storage
-
size
int size()
Returns the number of elements in the store.- Throws:
PersistenceException- in case of an error, e.g. communicating with the external storage
-
publishKeys
default org.reactivestreams.Publisher<K> publishKeys(java.util.function.Predicate<? super K> filter)
Publishes all the keys from this store. The given publisher can be used by as manySubscribers as desired. Keys are not retrieved until a given Subscriber requests them from theSubscription.Stores will return only non expired keys
- Parameters:
filter- a filter - null is treated as allowing all entries- Returns:
- a publisher that will provide the keys from the store
-
publishEntries
@Deprecated default org.reactivestreams.Publisher<MarshalledEntry<K,V>> publishEntries(java.util.function.Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)
Deprecated.since 10.0, please usentryPublisher(Predicate, boolean, boolean)instead.Publishes all entries from this store. The given publisher can be used by as manySubscribers as desired. Entries are not retrieved until a given Subscriber requests them from theSubscription.If fetchMetadata is true this store must guarantee to not return any expired entries.
- Parameters:
filter- a filter - null is treated as allowing all entriesfetchValue- whether or not to fetch the value from the persistent store. E.g. if the iteration is intended only over the key set, no point fetching the values from the persistent store as wellfetchMetadata- whether or not to fetch the metadata from the persistent store. E.g. if the iteration is intended only ove the key set, then no point fetching the metadata from the persistent store as well- Returns:
- a publisher that will provide the entries from the store
-
entryPublisher
default org.reactivestreams.Publisher<MarshallableEntry<K,V>> entryPublisher(java.util.function.Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)
Publishes all entries from this store. The given publisher can be used by as manySubscribers as desired. Entries are not retrieved until a given Subscriber requests them from theSubscription.If fetchMetadata is true this store must guarantee to not return any expired entries.
- Parameters:
filter- a filter - null is treated as allowing all entriesfetchValue- whether or not to fetch the value from the persistent store. E.g. if the iteration is intended only over the key set, no point fetching the values from the persistent store as wellfetchMetadata- whether or not to fetch the metadata from the persistent store. E.g. if the iteration is intended only ove the key set, then no point fetching the metadata from the persistent store as well- Returns:
- a publisher that will provide the entries from the store
-
-