Class NoopSegmentMetadataCache
java.lang.Object
org.apache.druid.metadata.segment.cache.NoopSegmentMetadataCache
- All Implemented Interfaces:
SegmentMetadataCache
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.metadata.segment.cache.SegmentMetadataCache
SegmentMetadataCache.Action<T>, SegmentMetadataCache.UsageMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidawaitNextSync(long timeoutMillis) Waits until the cache finishes the next sync with the metadata store or until the timeout elapses, whichever is sooner.voidRefreshes the cache once the service is elected leader.static NoopSegmentMetadataCacheinstance()booleanboolean<T> TreadCacheForDataSource(String dataSource, SegmentMetadataCache.Action<T> readAction) Performs a thread-safe read action on the cache for the given datasource.voidstart()Starts the cache on service start.voidstop()Stops the cache on service stop.voidNotifies the cache that the service has lost leadership.<T> TwriteCacheForDataSource(String dataSource, SegmentMetadataCache.Action<T> writeAction) Performs a thread-safe write action on the cache for the given datasource.
-
Constructor Details
-
NoopSegmentMetadataCache
public NoopSegmentMetadataCache()
-
-
Method Details
-
instance
-
start
public void start()Description copied from interface:SegmentMetadataCacheStarts the cache on service start.- Specified by:
startin interfaceSegmentMetadataCache
-
stop
public void stop()Description copied from interface:SegmentMetadataCacheStops the cache on service stop.- Specified by:
stopin interfaceSegmentMetadataCache
-
becomeLeader
public void becomeLeader()Description copied from interface:SegmentMetadataCacheRefreshes the cache once the service is elected leader.- Specified by:
becomeLeaderin interfaceSegmentMetadataCache
-
stopBeingLeader
public void stopBeingLeader()Description copied from interface:SegmentMetadataCacheNotifies the cache that the service has lost leadership.- Specified by:
stopBeingLeaderin interfaceSegmentMetadataCache
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceSegmentMetadataCache- Returns:
- true if the cache is enabled
-
isSyncedForRead
public boolean isSyncedForRead()- Specified by:
isSyncedForReadin interfaceSegmentMetadataCache- Returns:
- true if the cache is enabled and synced with the metadata store. Reads can be done from the cache only if it is synced but writes can happen even before the sync has finished.
-
awaitNextSync
public void awaitNextSync(long timeoutMillis) Description copied from interface:SegmentMetadataCacheWaits until the cache finishes the next sync with the metadata store or until the timeout elapses, whichever is sooner.- Specified by:
awaitNextSyncin interfaceSegmentMetadataCache
-
getDataSourcesSnapshot
- Specified by:
getDataSourcesSnapshotin interfaceSegmentMetadataCache- Returns:
- Latest snapshot of the datasources with all their used segments.
-
readCacheForDataSource
Description copied from interface:SegmentMetadataCachePerforms a thread-safe read action on the cache for the given datasource. Read actions can be concurrent with other reads but are mutually exclusive from other write actions on the same datasource.- Specified by:
readCacheForDataSourcein interfaceSegmentMetadataCache
-
writeCacheForDataSource
Description copied from interface:SegmentMetadataCachePerforms a thread-safe write action on the cache for the given datasource. Write actions are mutually exclusive from other writes or reads on the same datasource.- Specified by:
writeCacheForDataSourcein interfaceSegmentMetadataCache
-