@Override public void flush() throws IOException { // TODO(yupeng): Handle flush for Tachyon storage stream as well. if (mUnderStorageType.isSyncPersist()) { mUnderStorageOutputStream.flush(); } }
public static UnderStorageType option(String[] args, int index, UnderStorageType defaultValue) { if (index < args.length && index >= 0) { try { return UnderStorageType.valueOf(args[index]); } catch (IllegalArgumentException e) { System.err.println("Unable to parse UnderStorageType;" + e.getMessage()); System.err.println("Defaulting to " + defaultValue); return defaultValue; } } else { return defaultValue; } }
protected void handleCacheWriteException(IOException ioe) throws IOException { if (!mUnderStorageType.isSyncPersist()) { // TODO(yupeng): Handle this exception better. throw new IOException("Fail to cache: " + ioe.getMessage(), ioe); } LOG.warn("Failed to write into TachyonStore, canceling write attempt.", ioe); if (mCurrentBlockOutStream != null) { mShouldCacheCurrentBlock = false; mCurrentBlockOutStream.cancel(); } }
/** * @return Thrift representation of the options */ public MkdirTOptions toThrift() { MkdirTOptions options = new MkdirTOptions(); options.setPersisted(mUnderStorageType.isSyncPersist()); options.setRecursive(mRecursive); return options; } }
/** * @return Thrift representation of the options */ public CreateTOptions toThrift() { CreateTOptions options = new CreateTOptions(); options.setBlockSizeBytes(mBlockSizeBytes); options.setPersisted(mUnderStorageType.isSyncPersist()); options.setRecursive(mRecursive); options.setTtl(mTTL); return options; } }
@Override public void write(int b) throws IOException { if (mShouldCacheCurrentBlock) { try { if (mCurrentBlockOutStream == null || mCurrentBlockOutStream.remaining() == 0) { getNextBlock(); } mCurrentBlockOutStream.write(b); } catch (IOException ioe) { handleCacheWriteException(ioe); } } if (mUnderStorageType.isSyncPersist()) { mUnderStorageOutputStream.write(b); ClientContext.getClientMetrics().incBytesWrittenUfs(1); } }
if (mUnderStorageType.isSyncPersist()) { mUnderStorageOutputStream.write(b, off, len); ClientContext.getClientMetrics().incBytesWrittenUfs(len);
if (mUnderStorageType.isSyncPersist()) { if (mCanceled) {
mContext = FileSystemContext.INSTANCE; mPreviousBlockOutStreams = new LinkedList<BufferedBlockOutStream>(); if (mUnderStorageType.isSyncPersist()) { FileInfo fileInfo = getFileInfo(); mUfsPath = fileInfo.getUfsPath();