public interface PersistenceManager extends Lifecycle
Modifier and Type | Interface and Description |
---|---|
static class |
PersistenceManager.AccessMode |
Modifier and Type | Method and Description |
---|---|
default CompletionStage<Boolean> |
addSegments(IntSet segments)
Notifies any underlying segmented stores that the segments provided are owned by this cache and to start/configure
any underlying resources required to handle requests for entries on the given segments.
|
CompletionStage<Void> |
clearAllStores(Predicate<? super StoreConfiguration> predicate)
Invokes
AdvancedCacheWriter.clear() on all the stores that aloes it. |
CompletionStage<Void> |
commitAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext,
Predicate<? super StoreConfiguration> predicate)
Perform the commit operation for the provided transaction on all Tx stores.
|
CompletionStage<Boolean> |
deleteFromAllStores(Object key,
int segment,
Predicate<? super StoreConfiguration> predicate) |
CompletionStage<Void> |
disableStore(String storeType)
Marks the given storage as disabled.
|
<T> Set<T> |
getStores(Class<T> storeClass) |
Collection<String> |
getStoresAsString() |
boolean |
hasWriter()
Returns whether the manager is enabled and has at least one store
|
boolean |
isAvailable() |
boolean |
isEnabled() |
boolean |
isPreloaded() |
boolean |
isReadOnly() |
<K,V> CompletionStage<MarshallableEntry<K,V>> |
loadFromAllStores(Object key,
boolean localInvocation,
boolean includeStores)
Loads an entry from the persistence store for the given key.
|
default <K,V> CompletionStage<MarshallableEntry<K,V>> |
loadFromAllStores(Object key,
int segment,
boolean localInvocation,
boolean includeStores)
Same as
loadFromAllStores(Object, boolean, boolean) except that the segment of the key is also
provided to avoid having to calculate the segment. |
CompletionStage<Long> |
performBatch(TxInvocationContext<AbstractCacheTransaction> invocationContext,
BiPredicate<? super WriteCommand,Object> commandKeyPredicate)
Writes a batch for the given modifications in the transactional context
|
CompletionStage<Void> |
preload()
Loads the data from the external store into memory during cache startup.
|
CompletionStage<Void> |
prepareAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext,
Predicate<? super StoreConfiguration> predicate)
Perform the prepare phase of 2PC on all Tx stores.
|
default <K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> |
publishEntries(boolean fetchValue,
boolean fetchMetadata)
|
<K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> |
publishEntries(IntSet segments,
Predicate<? super K> filter,
boolean fetchValue,
boolean fetchMetadata,
Predicate<? super StoreConfiguration> predicate)
Returns a publisher that will publish entries that map to the provided segments.
|
<K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> |
publishEntries(Predicate<? super K> filter,
boolean fetchValue,
boolean fetchMetadata,
Predicate<? super StoreConfiguration> predicate)
Returns a publisher that will publish all entries stored by the underlying cache store.
|
<K> org.reactivestreams.Publisher<K> |
publishKeys(IntSet segments,
Predicate<? super K> filter,
Predicate<? super StoreConfiguration> predicate)
Returns a publisher that will publish keys that map to the provided segments.
|
<K> org.reactivestreams.Publisher<K> |
publishKeys(Predicate<? super K> filter,
Predicate<? super StoreConfiguration> predicate)
Returns a publisher that will publish all keys stored by the underlying cache store.
|
CompletionStage<Void> |
purgeExpired()
Removes the expired entries from all the existing storage.
|
default CompletionStage<Boolean> |
removeSegments(IntSet segments)
Notifies any underlying segmented stores that a given segment is no longer owned by this cache and allowing
it to remove the given segments and release resources related to it.
|
CompletionStage<Void> |
rollbackAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext,
Predicate<? super StoreConfiguration> predicate)
Perform the rollback operation for the provided transaction on all Tx stores.
|
void |
setClearOnStop(boolean clearOnStop) |
default CompletionStage<Long> |
size() |
CompletionStage<Long> |
size(IntSet segments)
Returns the count of how many entries are persisted within the given segments.
|
CompletionStage<Long> |
size(Predicate<? super StoreConfiguration> predicate)
Returns the count of how many entries are persisted.
|
<K,V> CompletionStage<Void> |
writeEntries(Iterable<MarshallableEntry<K,V>> iterable,
Predicate<? super StoreConfiguration> predicate)
Writes the entries to the stores that pass the given predicate
|
CompletionStage<Long> |
writeMapCommand(PutMapCommand putMapCommand,
InvocationContext ctx,
BiPredicate<? super PutMapCommand,Object> commandKeyPredicate)
Writes the values modified from a put map command to the stores.
|
default CompletionStage<Void> |
writeToAllNonTxStores(MarshallableEntry marshalledEntry,
int segment,
Predicate<? super StoreConfiguration> predicate)
Write to all stores that are not transactional.
|
CompletionStage<Void> |
writeToAllNonTxStores(MarshallableEntry marshalledEntry,
int segment,
Predicate<? super StoreConfiguration> predicate,
long flags) |
boolean isEnabled()
boolean hasWriter()
boolean isPreloaded()
CompletionStage<Void> preload()
CompletionStage<Void> disableStore(String storeType)
Collection<String> getStoresAsString()
CompletionStage<Void> purgeExpired()
CompletionStage<Void> clearAllStores(Predicate<? super StoreConfiguration> predicate)
AdvancedCacheWriter.clear()
on all the stores that aloes it.CompletionStage<Boolean> deleteFromAllStores(Object key, int segment, Predicate<? super StoreConfiguration> predicate)
default <K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> publishEntries(boolean fetchValue, boolean fetchMetadata)
<K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> publishEntries(Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata, Predicate<? super StoreConfiguration> predicate)
AdvancedCacheLoader
will be used. Predicate is applied by the underlying
loader in a best attempt to improve performance.
Caller can tell the store to also fetch the value or metadata. In some cases this can improve performance. If metadata is not fetched the publisher may include expired entries.
K
- key typeV
- value typefilter
- filter so that only entries whose key matches are returnedfetchValue
- whether to fetch value or notfetchMetadata
- whether to fetch metadata or notpredicate
- whether a store can be used by publish entries<K,V> org.reactivestreams.Publisher<MarshallableEntry<K,V>> publishEntries(IntSet segments, Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata, Predicate<? super StoreConfiguration> predicate)
K
- key typeV
- value typesegments
- only entries that map to these segments are processedfilter
- filter so that only entries whose key matches are returnedfetchValue
- whether to fetch value or notfetchMetadata
- whether to fetch metadata or notpredicate
- whether a store can be used by publish entries<K> org.reactivestreams.Publisher<K> publishKeys(Predicate<? super K> filter, Predicate<? super StoreConfiguration> predicate)
AdvancedCacheLoader
will be used. Predicate is applied by the underlying
loader in a best attempt to improve performance.
This method should be preferred over publishEntries(Predicate, boolean, boolean, Predicate)
when only
keys are desired as many stores can do this in a significantly more performant way.
This publisher will never return a key which belongs to an expired entry
K
- key typefilter
- filter so that only keys which match are returnedpredicate
- access mode to choose what type of loader to use<K> org.reactivestreams.Publisher<K> publishKeys(IntSet segments, Predicate<? super K> filter, Predicate<? super StoreConfiguration> predicate)
This method should be preferred over publishEntries(IntSet, Predicate, boolean, boolean, Predicate)
when only keys are desired as many stores can do this in a significantly more performant way.
This publisher will never return a key which belongs to an expired entry
K
- key typesegments
- only keys that map to these segments are processedfilter
- filter so that only keys which match are returnedpredicate
- access mode to choose what type of loader to use<K,V> CompletionStage<MarshallableEntry<K,V>> loadFromAllStores(Object key, boolean localInvocation, boolean includeStores)
key
- key to read the entry fromlocalInvocation
- whether this invocation is a local invocation. Some loaders may be ignored if it is not localincludeStores
- if a loader that is also a store can be loaded fromdefault <K,V> CompletionStage<MarshallableEntry<K,V>> loadFromAllStores(Object key, int segment, boolean localInvocation, boolean includeStores)
loadFromAllStores(Object, boolean, boolean)
except that the segment of the key is also
provided to avoid having to calculate the segment.key
- key to read the entry fromsegment
- segment the key maps tolocalInvocation
- whether this invocation is a local invocation. Some loaders may be ignored if it is not localincludeStores
- if a loader that is also a store can be loaded fromdefault CompletionStage<Long> size()
CompletionStage<Long> size(Predicate<? super StoreConfiguration> predicate)
predicate
- whether a loader can be usedCompletionStage<Long> size(IntSet segments)
segments
- which segments to count entries fromvoid setClearOnStop(boolean clearOnStop)
default CompletionStage<Void> writeToAllNonTxStores(MarshallableEntry marshalledEntry, int segment, Predicate<? super StoreConfiguration> predicate)
TransactionalCacheWriter
marshalledEntry
- the entry to be written to all non-tx stores.segment
- the segment the entry maps topredicate
- should we write to a given storeCompletionStage<Void> writeToAllNonTxStores(MarshallableEntry marshalledEntry, int segment, Predicate<? super StoreConfiguration> predicate, long flags)
flags
- Flags used during command invocationwriteToAllNonTxStores(MarshallableEntry, int, Predicate)
CompletionStage<Void> prepareAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext, Predicate<? super StoreConfiguration> predicate) throws PersistenceException
txInvocationContext
- the tx invocation containing the modificationspredicate
- should we prepare on a given storePersistenceException
- if an error is encountered at any of the underlying stores.CompletionStage<Void> commitAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext, Predicate<? super StoreConfiguration> predicate)
txInvocationContext
- the transactional context to be committed.predicate
- should we commit each storeCompletionStage<Void> rollbackAllTxStores(TxInvocationContext<AbstractCacheTransaction> txInvocationContext, Predicate<? super StoreConfiguration> predicate)
txInvocationContext
- the transactional context to be rolledback.predicate
- should we rollback each storeCompletionStage<Long> writeMapCommand(PutMapCommand putMapCommand, InvocationContext ctx, BiPredicate<? super PutMapCommand,Object> commandKeyPredicate)
putMapCommand
- the put map command to write values fromctx
- context to lookup entriescommandKeyPredicate
- predicate to control if a key/command combination should be acceptedCompletionStage<Long> performBatch(TxInvocationContext<AbstractCacheTransaction> invocationContext, BiPredicate<? super WriteCommand,Object> commandKeyPredicate)
invocationContext
- transactional contextcommandKeyPredicate
- predicate to control if a key/command combination should be accepted<K,V> CompletionStage<Void> writeEntries(Iterable<MarshallableEntry<K,V>> iterable, Predicate<? super StoreConfiguration> predicate)
K
- key typeV
- value typeiterable
- entries to writepredicate
- predicate to test for a storeboolean isAvailable()
default CompletionStage<Boolean> addSegments(IntSet segments)
This only affects stores that are not shared as shared stores have to keep all segments running at all times
This method returns true if all stores were able to handle the added segments. That is that either there are no stores or that all the configured stores are segmented. Note that configured loaders do not affect the return value.
segments
- segments this cache ownsdefault CompletionStage<Boolean> removeSegments(IntSet segments)
This only affects stores that are not shared as shared stores have to keep all segments running at all times
This method returns true if all stores were able to handle the removed segments. That is that either there are no stores or that all the configured stores are segmented. Note that configured loaders do not affect the return value.
segments
- segments this cache no longer ownsboolean isReadOnly()
CacheWriter
instances have been configured.Copyright © 2021 JBoss by Red Hat. All rights reserved.