PackExt types.
Allows the separation of entries from different PackExt types to
limit churn in cache caused by entries of differing sizes.
Separating these tables enables the fine-tuning of cache tables per extension type.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final DfsBlockCacheTable | |
| private final Map | |
| private final String | name
Table name. |
| Access | Constructor and Description |
|---|---|
| private | PackExtBlockCacheTable(String name, DfsBlockCacheTable defaultBlockCacheTable, List<DfsBlockCacheTable> blockCacheTableList, Map<PackExt, DfsBlockCacheTable> extBlockCacheTables)
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | contains(DfsStreamKey
the stream key of the pack. key, long the position in the key. position)Implements org. Check if the block cache contains an object identified by (key, position). |
| pack-priv static PackExtBlockCacheTable | Returns: the cache table built from the given configs.DfsBlockCacheConfig containing
DfsBlockCachePackExtConfigs used to configure
PackExtBlockCacheTable. The DfsBlockCacheConfig holds
the configuration for the default cache table.Builds the PackExtBlockCacheTable from a list of
|
| pack-priv static PackExtBlockCacheTable | Returns: the PackExtBlockCacheTable created from the defaultBlockCacheTable and packExtsCacheTablePairs mapping.the default table used when a handling a defaultBlockCacheTable, Map<PackExt, DfsBlockCacheTable> PackExt type
that does not map to a DfsBlockCacheTable mapped by
packExtsCacheTablePairs.the mapping of packExtBlockCacheTables)PackExts to
DfsBlockCacheTables. A single
DfsBlockCacheTable can be defined for multiple
PackExts in a many-to-one relationship.Creates a new PackExtBlockCacheTable from the combination of a default
|
| public <T> T | get(DfsStreamKey
the stream key of the pack. key, long the position in the key. position)Implements org. Get the object identified by (key, position) from the block cache. |
| public List | getBlockCacheStats()
Implements org. Get the list of |
| public String | getName()
Implements org. Get the name of the table. |
| public DfsBlock | getOrLoad(BlockBasedFile
the pack that "contains" the cached object. file, long offset within position, DfsReader pack of the object.current thread's reader. dfsReader, DfsBlockCache.supplier for channel to read fileChannelpack.Implements org. Look up a cached object, creating and loading it if it doesn't exist. |
| public <T> DfsBlockCache. | getOrLoadRef(DfsStreamKey
the stream key of the pack. key, long the position in the key. The default should be 0. position, DfsBlockCache.the function to load the reference. loaderImplements org. Look up a cached object, creating and loading it if it doesn't exist. |
| private static PackExt | |
| private DfsBlockCacheTable | |
| private DfsBlockCacheTable | |
| public boolean | hasBlock0(DfsStreamKey
the file to check. key)Implements org. Quickly check if the cache contains block 0 of the given stream. |
| public void | put(DfsBlock
the block to put in the cache. v)Implements org. Put a block in the block cache. |
| public <T> DfsBlockCache. | put(DfsStreamKey
the stream key of the pack. key, long the position in the key. pos, long the size of the object. size, T the object to put in the block cache. v)Implements org. Put a block in the block cache. |
| public <T> DfsBlockCache. | putRef(DfsStreamKey
the stream key of the pack. key, long the size of the object. size, T the object to put in the block cache. v)Implements org. Put an object in the block cache. |
| blockCacheTableList | back to summary |
|---|---|
| private final List<DfsBlockCacheTable> blockCacheTableList | |
| defaultBlockCacheTable | back to summary |
|---|---|
| private final DfsBlockCacheTable defaultBlockCacheTable | |
| extBlockCacheTables | back to summary |
|---|---|
| private final Map<PackExt, DfsBlockCacheTable> extBlockCacheTables | |
| name | back to summary |
|---|---|
| private final String name Table name. | |
| PackExtBlockCacheTable | back to summary |
|---|---|
| private PackExtBlockCacheTable(String name, DfsBlockCacheTable defaultBlockCacheTable, List<DfsBlockCacheTable> blockCacheTableList, Map<PackExt, DfsBlockCacheTable> extBlockCacheTables) | |
| contains | back to summary |
|---|---|
| public boolean contains(DfsStreamKey key, long position) Implements org. Doc from org. Check if the block cache contains an object identified by (key, position).
| |
| fromBlockCacheConfigs | back to summary |
|---|---|
| pack-priv static PackExtBlockCacheTable fromBlockCacheConfigs(DfsBlockCacheConfig cacheConfig) Builds the PackExtBlockCacheTable from a list of
| |
| fromCacheTables | back to summary |
|---|---|
| pack-priv static PackExtBlockCacheTable fromCacheTables(DfsBlockCacheTable defaultBlockCacheTable, Map<PackExt, DfsBlockCacheTable> packExtBlockCacheTables) Creates a new PackExtBlockCacheTable from the combination of a default
This method allows for the PackExtBlockCacheTable to handle a mapping of
This is currently made visible for testing.
| |
| get | back to summary |
|---|---|
| public <T> T get(DfsStreamKey key, long position) Implements org. Doc from org. Get the object identified by (key, position) from the block cache.
| |
| getBlockCacheStats | back to summary |
|---|---|
| public List Implements org. Doc from org. Get the list of
The returned list has a
| |
| getName | back to summary |
|---|---|
| public String getName() Implements org. Doc from org. Get the name of the table. | |
| getOrLoad | back to summary |
|---|---|
| public DfsBlock getOrLoad(BlockBasedFile file, long position, DfsReader dfsReader, DfsBlockCache. Implements org. Doc from org. Look up a cached object, creating and loading it if it doesn't exist.
| |
| getOrLoadRef | back to summary |
|---|---|
| public <T> DfsBlockCache. Implements org. Doc from org. Look up a cached object, creating and loading it if it doesn't exist.
| |
| getPackExt | back to summary |
|---|---|
| private static PackExt getPackExt(DfsStreamKey key) | |
| getTable | back to summary |
|---|---|
| private DfsBlockCacheTable getTable(PackExt packExt) | |
| getTable | back to summary |
|---|---|
| private DfsBlockCacheTable getTable(DfsStreamKey key) | |
| hasBlock0 | back to summary |
|---|---|
| public boolean hasBlock0(DfsStreamKey key) Implements org. Doc from org. Quickly check if the cache contains block 0 of the given stream. This can be useful for sophisticated pre-read algorithms to quickly determine if a file is likely already in cache, especially small reftables which may be smaller than a typical DFS block size.
| |
| put | back to summary |
|---|---|
| public void put(DfsBlock v) Implements org. Doc from org. Put a block in the block cache. | |
| put | back to summary |
|---|---|
| public <T> DfsBlockCache. Implements org. Doc from org. Put a block in the block cache.
| |
| putRef | back to summary |
|---|---|
| public <T> DfsBlockCache. Implements org. Doc from org. Put an object in the block cache.
| |