@Test public void testGetPersistDir() throws Exception { State state = new State(); Assert.assertFalse(RecoveryHelper.getPersistDir(state).isPresent()); state.setProp(RecoveryHelper.PERSIST_DIR_KEY, this.tmpDir.getAbsolutePath()); Assert.assertTrue(RecoveryHelper.getPersistDir(state).isPresent()); Assert.assertTrue(RecoveryHelper.getPersistDir(state).get().toUri().getPath(). startsWith(this.tmpDir.getAbsolutePath())); }
public static Optional<Path> getPersistDir(State state) throws IOException { if (state.contains(PERSIST_DIR_KEY)) { return Optional .of(new Path(state.getProp(PERSIST_DIR_KEY), UserGroupInformation.getCurrentUser().getShortUserName())); } return Optional.absent(); }
RecoveryHelper { public static Optional<Path> getPersistDir(State state) throws IOException { if (state.contains(PERSIST_DIR_KEY)) { return Optional .of(new Path(state.getProp(PERSIST_DIR_KEY), UserGroupInformation.getCurrentUser().getShortUserName())); } return Optional.absent(); } }
RecoveryHelper { public static Optional<Path> getPersistDir(State state) throws IOException { if (state.contains(PERSIST_DIR_KEY)) { return Optional .of(new Path(state.getProp(PERSIST_DIR_KEY), UserGroupInformation.getCurrentUser().getShortUserName())); } return Optional.absent(); } RecoveryHelper(FileSystem fs, State state); }
RecoveryHelper { public static Optional<Path> getPersistDir(State state) throws IOException { if (state.contains(PERSIST_DIR_KEY)) { return Optional .of(new Path(state.getProp(PERSIST_DIR_KEY), UserGroupInformation.getCurrentUser().getShortUserName())); } return Optional.absent(); } RecoveryHelper(FileSystem fs, State state); static Optional<Path> getPersistDir(State state); boolean persistFile(State state, CopyableFile file, Path path); Optional<FileStatus> findPersistedFile(State state, CopyEntity file, Predicate<FileStatus> filter); void purgeOldPersistedFile(); }
RecoveryHelper { public static Optional<Path> getPersistDir(State state) throws IOException { if (state.contains(PERSIST_DIR_KEY)) { return Optional .of(new Path(state.getProp(PERSIST_DIR_KEY), UserGroupInformation.getCurrentUser().getShortUserName())); } return Optional.absent(); } RecoveryHelper(FileSystem fs, State state); static Optional<Path> getPersistDir(State state); boolean persistFile(State state, CopyableFile file, Path path); Optional<FileStatus> findPersistedFile(State state, CopyEntity file, Predicate<FileStatus> filter); void purgeOldPersistedFile(); static final String PERSIST_DIR_KEY; static final String PERSIST_RETENTION_KEY; static final int DEFAULT_PERSIST_RETENTION; }