fileId = getValidFileId(fileId, path); try { info = mFSMasterClient.getFileInfo(fileId);
/** * Deletes a file or folder. * * @param fileId The id of the file / folder. If it is not INVALID_FILE_ID, path parameter is * ignored. Otherwise, the method uses the path parameter. * @param path The path of the file / folder. It could be empty iff id is not INVALID_FILE_ID. * @param recursive If fileId or path represents a non-empty folder, delete the folder recursively * or not. * @return true if deletes successfully, false otherwise * @throws IOException if the underlying master RPC fails */ @Override public synchronized boolean delete(long fileId, TachyonURI path, boolean recursive) throws IOException { validateUri(path); fileId = getValidFileId(fileId, path.getPath()); try { return mFSMasterClient.deleteFile(fileId, recursive); } catch (TachyonException e) { throw new IOException(e); } }
/** * Frees an in-memory file or folder. * * @param fileId The id of the file / folder. If it is not INVALID_FILE_ID, path parameter is * ignored. Otherwise, the method uses the path parameter. * @param path The path of the file / folder. It could be empty iff id is not INVALID_FILE_ID. * @param recursive If fileId or path represents a non-empty folder, free the folder recursively * or not * @return true if in-memory free successfully, false otherwise * @throws IOException if the underlying master RPC fails */ @Override public synchronized boolean freepath(long fileId, TachyonURI path, boolean recursive) throws IOException { validateUri(path); fileId = getValidFileId(fileId, path.getPath()); try { return mFSMasterClient.free(fileId, recursive); } catch (TachyonException e) { throw new IOException(e); } }
/** * Advanced API. * * Gets the FileInfo object that represents the fileId, or the path if fileId is INVALID_FILE_ID. * * @param fileId the file id of the file or folder. * @param path the path of the file or folder. valid iff fileId is INVALID_FILE_ID. * @param useCachedMetadata if true use the local cached meta data * @return the FileInfo of the file. null if the file does not exist * @throws IOException if the underlying master RPC fails */ public synchronized FileInfo getFileStatus(long fileId, TachyonURI path, boolean useCachedMetadata) throws IOException { fileId = getValidFileId(fileId, path.getPath()); return getFileStatus(mIdToClientFileInfo, fileId, fileId, TachyonURI.EMPTY_URI.getPath(), useCachedMetadata); }
/** * Renames a file or folder to the indicated new path. * * @param fileId The id of the source file / folder. If it is not INVALID_FILE_ID, path parameter * is ignored. Otherwise, the method uses the srcPath parameter. * @param srcPath The path of the source file / folder. It could be empty iff id is not * INVALID_FILE_ID. * @param dstPath The path of the destination file / folder. It could be empty iff id is not * INVALID_FILE_ID. * @return true if renames successfully, false otherwise * @throws IOException if the underlying master RPC fails */ @Override public synchronized boolean rename(long fileId, TachyonURI srcPath, TachyonURI dstPath) throws IOException { validateUri(srcPath); validateUri(dstPath); fileId = getValidFileId(fileId, srcPath.getPath()); try { return mFSMasterClient.renameFile(fileId, dstPath.getPath()); } catch (TachyonException e) { throw new IOException(e); } }