/** * @param fileId the file id * @return the file info for the given file id * @throws IOException if an I/O error occurs */ // TODO(jiri): Factor this method out to a common client. public synchronized FileInfo getFileInfo(long fileId) throws IOException { int retry = 0; while (!mClosed && (retry ++) <= RPC_MAX_NUM_RETRY) { connect(); try { return mClient.getFileInfo(fileId); } catch (TachyonTException e) { throw new IOException(e); } catch (TException e) { LOG.error(e.getMessage(), e); mConnected = false; } } throw new IOException("Failed after " + retry + " retries."); }
/** * @return the set of pinned file ids * @throws IOException if an I/O error occurs */ public synchronized Set<Long> getPinList() throws IOException { int retry = 0; while (!mClosed && (retry ++) <= RPC_MAX_NUM_RETRY) { connect(); try { return mClient.workerGetPinIdList(); } catch (TachyonTException e) { throw new IOException(e); } catch (TException e) { LOG.error(e.getMessage(), e); mConnected = false; } } throw new IOException("Failed after " + retry + " retries."); } }
/** * Persists a file. * * @param fileId the file id * @param length the checkpoint length * @return whether operation succeeded or not * @throws IOException if an I/O error occurs */ public synchronized boolean persistFile(long fileId, long length) throws IOException { int retry = 0; while (!mClosed && (retry ++) <= RPC_MAX_NUM_RETRY) { connect(); try { return mClient.persistFile(fileId, length); } catch (TachyonTException e) { throw new IOException(e); } catch (TException e) { LOG.error(e.getMessage(), e); mConnected = false; } } throw new IOException("Failed after " + retry + " retries."); }