@Test public void testGetLocalPath() { String localRelPath = "testbucket/123/4566/789"; String remotePath = "s3: CacheConfig.setCacheDataDirPrefix(conf, cacheTestDirPrefix); CacheConfig.setCacheDataDirSuffix(conf, "/fcache/"); CacheConfig.setMaxDisks(conf, 1); createCacheDirectoriesForTest(conf); String localPath = CacheUtil.getLocalPath(remotePath, conf, UNKONWN_GENERATION_NUMBER + 1); assertEquals(localPath, getExpectedPath(cacheTestDirPrefix, localRelPath, false), "Paths not equal!"); }
public static String getLocalPath(String remotePath, Configuration conf, int generationNumber) { checkState(generationNumber != UNKONWN_GENERATION_NUMBER, "generationNumber is " + UNKONWN_GENERATION_NUMBER); final String absLocation = getDirectory(remotePath, conf); return String.format("%s/%s_g%d", absLocation, getName(remotePath), generationNumber); }
CacheUtil { public static String getLocalPath(String remotePath, Configuration conf, int generationNumber) { checkState(generationNumber != UNKONWN_GENERATION_NUMBER, "generationNumber is " + UNKONWN_GENERATION_NUMBER); final String absLocation = getDirectory(remotePath, conf); return String.format("%s/%s_g%d", absLocation, getName(remotePath), generationNumber); } }
CacheUtil { public static String getLocalPath(String remotePath, Configuration conf, int generationNumber) { checkState(generationNumber != UNKONWN_GENERATION_NUMBER, "generationNumber is " + UNKONWN_GENERATION_NUMBER); final String absLocation = getDirectory(remotePath, conf); return String.format("%s/%s_g%d", absLocation, getName(remotePath), generationNumber); } private  CacheUtil(); }
CacheUtil { public static String getLocalPath(String remotePath, Configuration conf, int generationNumber) { checkState(generationNumber != UNKONWN_GENERATION_NUMBER, "generationNumber is " + UNKONWN_GENERATION_NUMBER); final String absLocation = getDirectory(remotePath, conf); return String.format("%s/%s_g%d", absLocation, getName(remotePath), generationNumber); } private  CacheUtil(); static void createCacheDirectories(Configuration conf); static int getCacheDiskCount(Configuration conf); static HashMap<Integer, String> getCacheDiskPathsMap(final Configuration conf); static String getDirPath(int dirIndex, Configuration conf); static String getLocalPath(String remotePath, Configuration conf, int generationNumber); static String getMetadataFilePath(String remotePath, Configuration conf, int generationNumber); static boolean isMetadataFile(String filePath, Configuration conf); static boolean skipCache(String path, Configuration conf); static List<String> getDirPrefixList(Configuration conf); static String getName(String remotePath); }
CacheUtil { public static String getLocalPath(String remotePath, Configuration conf, int generationNumber) { checkState(generationNumber != UNKONWN_GENERATION_NUMBER, "generationNumber is " + UNKONWN_GENERATION_NUMBER); final String absLocation = getDirectory(remotePath, conf); return String.format("%s/%s_g%d", absLocation, getName(remotePath), generationNumber); } private  CacheUtil(); static void createCacheDirectories(Configuration conf); static int getCacheDiskCount(Configuration conf); static HashMap<Integer, String> getCacheDiskPathsMap(final Configuration conf); static String getDirPath(int dirIndex, Configuration conf); static String getLocalPath(String remotePath, Configuration conf, int generationNumber); static String getMetadataFilePath(String remotePath, Configuration conf, int generationNumber); static boolean isMetadataFile(String filePath, Configuration conf); static boolean skipCache(String path, Configuration conf); static List<String> getDirPrefixList(Configuration conf); static String getName(String remotePath); static final int UNKONWN_GENERATION_NUMBER; static final int DUMMY_MODE_GENERATION_NUMBER; }