Class CachedRecordStore<R extends BaseRecord>
java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.RecordStore<R>
org.apache.hadoop.hdfs.server.federation.store.CachedRecordStore<R>
- Type Parameters:
R- Record to store by this interface.
- All Implemented Interfaces:
StateStoreCache
- Direct Known Subclasses:
DisabledNameserviceStore,MembershipStore,MountTableStore,RouterStore
public abstract class CachedRecordStore<R extends BaseRecord>
extends RecordStore<R>
implements StateStoreCache
Record store that takes care of caching the records in memory.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCachedRecordStore(Class<R> clazz, StateStoreDriver driver) Create a new cached record store.protectedCachedRecordStore(Class<R> clazz, StateStoreDriver driver, boolean over) Create a new cached record store. -
Method Summary
Modifier and TypeMethodDescriptionGet all the cached records.protected QueryResult<R>Get all the cached records and the time stamp of the cache.booleanloadCache(boolean force) Load the cache from the State Store.voidoverrideExpiredRecord(R record) Updates the state store with any record overrides we detected, such as an expired state.voidoverrideExpiredRecords(QueryResult<R> query) Updates the state store with any record overrides we detected, such as an expired state.Methods inherited from class org.apache.hadoop.hdfs.server.federation.store.RecordStore
getDriver, getRecordClass, newInstance
-
Constructor Details
-
CachedRecordStore
Create a new cached record store.- Parameters:
clazz- Class of the record to store.driver- State Store driver.
-
CachedRecordStore
Create a new cached record store.- Parameters:
clazz- Class of the record to store.driver- State Store driver.over- If the entries should be overridden if they expire
-
-
Method Details
-
loadCache
Description copied from interface:StateStoreCacheLoad the cache from the State Store. Called by the cache update service when the data has been reloaded.- Specified by:
loadCachein interfaceStateStoreCache- Parameters:
force- If we force the load.- Returns:
- If the cache was loaded successfully.
- Throws:
IOException- If there was an error loading the cache.
-
overrideExpiredRecords
Updates the state store with any record overrides we detected, such as an expired state. If an expired record exists beyond deletion time, it is removed.- Parameters:
query- RecordQueryResult containing the data to be inspected.- Throws:
IOException- If the values cannot be updated.
-
overrideExpiredRecord
Updates the state store with any record overrides we detected, such as an expired state.- Parameters:
record- record to be updated.- Throws:
IOException- If the values cannot be updated.
-
getCachedRecords
Get all the cached records.- Returns:
- Copy of the cached records.
- Throws:
StateStoreUnavailableException- If the State store is not available.
-
getCachedRecordsAndTimeStamp
Get all the cached records and the time stamp of the cache.- Returns:
- Copy of the cached records and the time stamp.
- Throws:
StateStoreUnavailableException- If the State store is not available.
-