| | |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | mayExtend=true, |
| | | mayInvoke=true, |
| | | notes="Entry cache methods may only be invoked by backends") |
| | | public abstract class EntryCache |
| | | <T extends EntryCacheCfg> |
| | | public abstract class EntryCache<T extends EntryCacheCfg> |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | // No implementation required. |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes this entry cache implementation so that it will be |
| | | * available for storing and retrieving entries. |
| | |
| | | public abstract void initializeEntryCache(T configuration) |
| | | throws ConfigException, InitializationException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided configuration is acceptable for |
| | | * this entry cache. It should be possible to call this method on |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Performs any necessary cleanup work (e.g., flushing all cached |
| | | * entries and releasing any other held resources) that should be |
| | |
| | | */ |
| | | public abstract void finalizeEntryCache(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the entry cache currently contains the entry |
| | | * with the specified DN. This method may be called without holding |
| | |
| | | */ |
| | | public abstract boolean containsEntry(DN entryDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the entry with the specified DN from the cache. |
| | | * |
| | |
| | | */ |
| | | public abstract Entry getEntry(DN entryDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the requested entry if it is present in the cache. |
| | | * |
| | |
| | | return getEntry(entryDN); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the entry ID for the entry with the specified DN from |
| | | * the cache. The caller should have already acquired a read or |
| | |
| | | */ |
| | | public abstract long getEntryID(DN entryDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the entry DN for the entry with the specified ID on |
| | | * the specific backend from the cache. The caller should have |
| | |
| | | */ |
| | | public abstract DN getEntryDN(Backend backend, long entryID); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Stores the provided entry in the cache. Note that the mechanism |
| | | * that it uses to achieve this is implementation-dependent, and it |
| | |
| | | public abstract void putEntry(Entry entry, Backend backend, |
| | | long entryID); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Stores the provided entry in the cache only if it does not |
| | | * conflict with an entry that already exists. Note that the |
| | |
| | | Backend backend, |
| | | long entryID); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes the specified entry from the cache. |
| | | * |
| | |
| | | */ |
| | | public abstract void removeEntry(DN entryDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes all entries from the cache. The cache should still be |
| | | * available for future use. |
| | | */ |
| | | public abstract void clear(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes all entries from the cache that are associated with the |
| | | * provided backend. |
| | |
| | | */ |
| | | public abstract void clearBackend(Backend backend); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes all entries from the cache that are below the provided |
| | | * DN. |
| | |
| | | */ |
| | | public abstract void clearSubtree(DN baseDN); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Attempts to react to a scenario in which it is determined that |
| | | * the system is running low on available memory. In this case, the |
| | |
| | | */ |
| | | public abstract void handleLowMemory(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the monitor that is associated with this entry |
| | | * cache. |
| | |
| | | return entryCacheMonitor; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the monitor for this entry cache. |
| | | * |
| | |
| | | this.entryCacheMonitor = entryCacheMonitor; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a set of attributes containing monitor data that should |
| | | * be returned to the client if the corresponding monitor entry is |
| | |
| | | */ |
| | | public abstract List<Attribute> getMonitorData(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the current number of entries stored within the cache. |
| | | * |
| | |
| | | */ |
| | | public abstract Long getCacheCount(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the current number of cache hits for this cache. |
| | | * |
| | |
| | | return cacheHits.longValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the current number of cache misses for this cache. |
| | | * |
| | |
| | | return cacheMisses.longValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of search filters that may be used to determine |
| | | * whether an entry should be excluded from the cache. |
| | |
| | | return excludeFilters; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the set of search filters that may be used to determine |
| | | * whether an entry should be excluded from the cache. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the set of search filters that may be used to determine |
| | | * whether an entry should be included in the cache. |
| | |
| | | return includeFilters; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the set of search filters that may be used to determine |
| | | * whether an entry should be included in the cache. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the current set of exclude and include filters |
| | | * allow caching of the specified entry. |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return a verbose string representation of the current cache maps. This is |
| | | * useful primary for debugging and diagnostic purposes such as in the entry |