/** * @param writeType the {@link tachyon.client.WriteType} to use for this operation. This will * override both the TachyonStorageType and UnderStorageType. * @return the builder */ public Builder setWriteType(WriteType writeType) { mTachyonStorageType = writeType.getTachyonStorageType(); mUnderStorageType = writeType.getUnderStorageType(); return this; }
/** * @return the {@link TachyonStorageType} which is associated with this mode */ public TachyonStorageType getTachyonStorageType() { if (isCache()) { return TachyonStorageType.STORE; } return TachyonStorageType.NO_STORE; }
/** * @return the {@link tachyon.client.UnderStorageType} which is associated with this mode */ public UnderStorageType getUnderStorageType() { if (isThrough()) { return UnderStorageType.SYNC_PERSIST; } return UnderStorageType.NO_PERSIST; }
/** * @param writeType the write type to use * @return the builder */ public Builder setWriteType(WriteType writeType) { mUnderStorageType = writeType.getUnderStorageType(); return this; }
public static WriteType option(String[] args, int index, WriteType defaultValue) { if (index < args.length && index >= 0) { try { return WriteType.valueOf(args[index]); } catch (IllegalArgumentException e) { System.err.println("Unable to parse WriteType;" + e.getMessage()); System.err.println("Defaulting to " + defaultValue); return defaultValue; } } else { return defaultValue; } }
/** * @param writeType the write type to use * @return the builder */ public Builder setWriteType(WriteType writeType) { mUnderStorageType = writeType.getUnderStorageType(); return this; }
public static void main(String[] args) throws IllegalArgumentException { if (args.length != 4) { System.out.println("java -cp " + Constants.TACHYON_JAR + " " + BasicOperations.class.getName() + " <ReadType (CACHE_PROMOTE | CACHE | NO_CACHE)> <WriteType (MUST_CACHE | CACHE_THROUGH" + " | THROUGH)>"); System.exit(-1); } Utils.runExample(new BasicOperations(new TachyonURI(args[0]), new TachyonURI(args[1]), ReadType.valueOf(args[2]), WriteType.valueOf(args[3]))); } }
/** * Creates a new builder for {@link OutStreamOptions}. * * @param conf a Tachyon configuration */ public Builder(TachyonConf conf) { mBlockSizeBytes = conf.getBytes(Constants.USER_BLOCK_SIZE_BYTES_DEFAULT); mHostname = null; WriteType defaultWriteType = conf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); mTachyonStorageType = defaultWriteType.getTachyonStorageType(); mUnderStorageType = defaultWriteType.getUnderStorageType(); mTTL = Constants.NO_TTL; }
/** * Creates a new builder for {@link MkdirOptions}. * * @param conf a Tachyon configuration */ public Builder(TachyonConf conf) { mRecursive = false; WriteType defaultWriteType = conf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); mUnderStorageType = defaultWriteType.getUnderStorageType(); }
public static void main(String[] args) throws IllegalArgumentException { if (args.length != 4) { System.out.println("java -cp " + Constants.TACHYON_JAR + " " + BasicRawTableOperations.class.getName() + " <master address> <file path> " + " <ReadType (CACHE_PROMOTE | CACHE | NO_CACHE)> <WriteType (MUST_CACHE | CACHE_THROUGH" + " | THROUGH)>"); System.exit(-1); } Utils.runExample(new BasicRawTableOperations(new TachyonURI(args[0]), new TachyonURI(args[1]), ReadType.valueOf(args[2]), WriteType.valueOf(args[3]))); } }
/** * @return the {@code OutStream} of this file * @throws IOException when an event that prevents the operation from completing is encountered */ public FileOutStream getOutStream() throws IOException { if (isCompleted()) { throw new IOException("Overriding after completion not supported."); } WriteType writeType = mTachyonConf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); FileInfo info = getUnCachedFileStatus(); OutStreamOptions.Builder optionsBuilder = new OutStreamOptions.Builder(mTachyonConf); optionsBuilder.setBlockSizeBytes(info.getBlockSizeBytes()) .setTachyonStorageType(writeType.getTachyonStorageType()) .setUnderStorageType(writeType.getUnderStorageType()); return mTFS.getOutStream(mFileId, optionsBuilder.build()); }
/** * Creates a new builder for {@link CreateOptions}. * * @param conf a Tachyon configuration */ public Builder(TachyonConf conf) { mBlockSizeBytes = conf.getBytes(Constants.USER_BLOCK_SIZE_BYTES_DEFAULT); mRecursive = false; mTTL = Constants.NO_TTL; WriteType defaultWriteType = conf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); mUnderStorageType = defaultWriteType.getUnderStorageType(); }