public class SoftIndexFileStore extends Object implements AdvancedLoadWriteStore
AdvancedCacheLoader.CacheLoaderTask<K,V>, AdvancedCacheLoader.TaskContext
AdvancedCacheWriter.PurgeListener<K>
Constructor and Description |
---|
SoftIndexFileStore() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all the data from the storage.
|
boolean |
contains(Object key)
Returns true if the storage contains an entry associated with the given key.
|
String |
debugInfo(Object key)
This method should be called by reflection to get more info about the missing/invalid key (from test tools)
|
boolean |
delete(Object key) |
void |
init(InitializationContext ctx)
Used to initialize a cache loader.
|
boolean |
isAvailable() |
protected boolean |
isIndexLoaded() |
protected boolean |
isSeqIdOld(long seqId,
Object key,
byte[] serializedKey) |
MarshalledEntry |
load(Object key)
Fetches an entry from the storage.
|
org.reactivestreams.Publisher<MarshalledEntry> |
publishEntries(Predicate filter,
boolean fetchValue,
boolean fetchMetadata)
Publishes all entries from this store.
|
org.reactivestreams.Publisher |
publishKeys(Predicate filter)
Publishes all the keys from this store.
|
void |
purge(Executor threadPool,
AdvancedCacheWriter.PurgeListener listener)
Using the thread in the pool, removed all the expired data from the persistence storage.
|
int |
size()
Returns the number of elements in the store.
|
void |
start()
Invoked on component start
|
protected void |
startIndex() |
void |
stop()
Invoked on component stop
|
void |
write(MarshalledEntry entry)
Persists the entry to the storage.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
process
deleteBatch, writeBatch
public void init(InitializationContext ctx)
CacheLoader
PersistenceManager
when setting up cache loaders.init
in interface CacheLoader
init
in interface CacheWriter
public void start()
Lifecycle
protected boolean isSeqIdOld(long seqId, Object key, byte[] serializedKey) throws IOException
IOException
protected void startIndex()
protected boolean isIndexLoaded()
public void stop()
Lifecycle
public boolean isAvailable()
isAvailable
in interface CacheLoader
isAvailable
in interface CacheWriter
isAvailable
in interface ExternalStore
public void clear() throws PersistenceException
AdvancedCacheWriter
clear
in interface AdvancedCacheWriter
PersistenceException
- in case of an error, e.g. communicating with the external storagepublic int size()
AdvancedCacheLoader
size
in interface AdvancedCacheLoader
public void purge(Executor threadPool, AdvancedCacheWriter.PurgeListener listener)
AdvancedCacheWriter
When this method returns all entries will be purged and no tasks will be running due to this loader in the provided executor. If however an exception is thrown there could be tasks still pending or running in the executor.
purge
in interface AdvancedCacheWriter
public void write(MarshalledEntry entry)
CacheWriter
write
in interface CacheWriter
MarshalledEntry
public boolean delete(Object key)
delete
in interface CacheWriter
public boolean contains(Object key)
CacheLoader
contains
in interface CacheLoader
public MarshalledEntry load(Object key)
CacheLoader
MarshalledEntry
needs to be created here, InitializationContext.getMarshalledEntryFactory()
and InitializationContext.getByteBufferFactory()
should be used.load
in interface CacheLoader
public String debugInfo(Object key)
key
- public org.reactivestreams.Publisher publishKeys(Predicate filter)
AdvancedCacheLoader
Subscriber
s as desired. Keys are not retrieved until a given Subscriber requests
them from the Subscription
.
Stores will return only non expired keys
publishKeys
in interface AdvancedCacheLoader
filter
- a filterpublic org.reactivestreams.Publisher<MarshalledEntry> publishEntries(Predicate filter, boolean fetchValue, boolean fetchMetadata)
AdvancedCacheLoader
Subscriber
s as desired. Entries are not retrieved until a given Subscriber requests
them from the Subscription
.
If fetchMetadata is true this store must guarantee to not return any expired entries.
publishEntries
in interface AdvancedCacheLoader
Copyright © 2020 JBoss, a division of Red Hat. All rights reserved.