/** * Sets the "pinned" flag for the given file. Pinned files are never evicted by Tachyon until they * are unpinned. * * Calling setPinned() on a folder will recursively set the "pinned" flag on all of that folder's * children. This may be an expensive operation for folders with many files/subfolders. * * @param fid the file id * @param pinned the target "pinned" flag value * @throws IOException if the underlying master RPC fails */ public synchronized void setPinned(long fid, boolean pinned) throws IOException { try { mFSMasterClient.setPinned(fid, pinned); } catch (TachyonException e) { throw new IOException(e); } }
@Override public void setState(TachyonFile file, SetStateOptions options) throws IOException, FileDoesNotExistException, TachyonException { FileSystemMasterClient masterClient = mContext.acquireMasterClient(); Boolean pinned = options.getPinned(); try { if (pinned != null) { masterClient.setPinned(file.getFileId(), pinned); LOG.info(pinned ? "Pinned" : "Unpinned" + " file " + file.getFileId()); } } catch (TachyonException e) { TachyonException.unwrap(e, FileDoesNotExistException.class); throw e; } finally { mContext.releaseMasterClient(masterClient); } }