@InterfaceAudience.Private public class BlockCacheUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
| (package private) static class  | BlockCacheUtil.CachedBlockCountsPerFileLittle data structure to hold counts for a file. | 
| static class  | BlockCacheUtil.CachedBlocksByFileUse one of these to keep a running account of cached blocks by file. | 
| Modifier and Type | Field and Description | 
|---|---|
| private static org.slf4j.Logger | LOG | 
| private static com.fasterxml.jackson.databind.ObjectMapper | MAPPERNeeded generating JSON. | 
| static long | NANOS_PER_SECOND | 
| Constructor and Description | 
|---|
| BlockCacheUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| private static int | compareCacheBlock(Cacheable left,
                 Cacheable right,
                 boolean includeNextBlockMetadata) | 
| static BlockCacheUtil.CachedBlocksByFile | getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf,
                           BlockCache bc)Get a  BlockCacheUtil.CachedBlocksByFileinstance and load it up by iterating content inBlockCache. | 
| static boolean | shouldReplaceExistingCacheBlock(BlockCache blockCache,
                               BlockCacheKey cacheKey,
                               Cacheable newBlock)Because of the region splitting, it's possible that the split key locate in the middle of a
 block. | 
| static String | toJSON(BlockCache bc) | 
| static String | toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf) | 
| static String | toJSON(String filename,
      NavigableSet<CachedBlock> blocks) | 
| static String | toString(CachedBlock cb,
        long now) | 
| static String | toStringMinusFileName(CachedBlock cb,
                     long now) | 
| static int | validateBlockAddition(Cacheable existing,
                     Cacheable newBlock,
                     BlockCacheKey cacheKey)Validate that the existing and newBlock are the same without including the nextBlockMetadata,
 if not, throw an exception. | 
private static final org.slf4j.Logger LOG
public static final long NANOS_PER_SECOND
private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
public BlockCacheUtil()
public static String toString(CachedBlock cb, long now)
cb - public static String toJSON(String filename, NavigableSet<CachedBlock> blocks) throws com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException, IOException
filename - blocks - filename and counts of blockscom.fasterxml.jackson.core.JsonGenerationExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static String toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf) throws com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException, IOException
cbsbf - cbsf aggregatedcom.fasterxml.jackson.core.JsonGenerationExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static String toJSON(BlockCache bc) throws com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException, IOException
bc - bc content.com.fasterxml.jackson.core.JsonGenerationExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static String toStringMinusFileName(CachedBlock cb, long now)
cb - bc as a String minus the filename.public static BlockCacheUtil.CachedBlocksByFile getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf, BlockCache bc)
BlockCacheUtil.CachedBlocksByFile instance and load it up by iterating content in
 BlockCache.conf - Used to read configurationsbc - Block Cache to iterate.private static int compareCacheBlock(Cacheable left, Cacheable right, boolean includeNextBlockMetadata)
public static int validateBlockAddition(Cacheable existing, Cacheable newBlock, BlockCacheKey cacheKey)
existing - block that is existing in the cache.newBlock - block that is trying to be cached.cacheKey - the cache key of the blocks.public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache, BlockCacheKey cacheKey, Cacheable newBlock)
blockCache - BlockCache to checkcacheKey - the block cache keynewBlock - the new block which try to put into the block cache.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.