public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public Builder mergeFrom(alluxio.grpc.CreateFilePOptions other) { if (other == alluxio.grpc.CreateFilePOptions.getDefaultInstance()) return this; if (other.hasBlockSizeBytes()) { setBlockSizeBytes(other.getBlockSizeBytes()); if (other.hasRecursive()) { setRecursive(other.getRecursive()); if (other.hasMode()) { mergeMode(other.getMode()); if (other.hasReplicationMax()) { setReplicationMax(other.getReplicationMax()); if (other.hasReplicationMin()) { setReplicationMin(other.getReplicationMin()); if (other.hasReplicationDurable()) { setReplicationDurable(other.getReplicationDurable()); if (other.hasFileWriteLocationPolicy()) { bitField0_ |= 0x00000040; fileWriteLocationPolicy_ = other.fileWriteLocationPolicy_; onChanged(); if (other.hasWriteTier()) { setWriteTier(other.getWriteTier()); if (other.hasWriteType()) { setWriteType(other.getWriteType());
if (options.hasBlockSizeBytes()) { mBlockSizeBytes = options.getBlockSizeBytes(); if (options.hasMode()) { mMode = Mode.fromProto(options.getMode()); if (options.hasReplicationDurable()) { mReplicationDurable = options.getReplicationDurable(); if (options.hasReplicationMin()) { mReplicationMin = options.getReplicationMin(); if (options.hasReplicationMax()) { mReplicationMax = options.getReplicationMax(); if (options.hasWriteTier()) { mWriteTier = options.getWriteTier(); if (options.hasWriteType()) { mWriteType = WriteType.fromProto(options.getWriteType()); if (options.hasFileWriteLocationPolicy()) { try { mLocationPolicy = (FileWriteLocationPolicy) CommonUtils.createNewClassInstance( Class.forName(options.getFileWriteLocationPolicy()), new Class[] {AlluxioConfiguration.class}, new Object[] {alluxioConf});
/** * <code>optional string fileWriteLocationPolicy = 7;</code> */ public Builder clearFileWriteLocationPolicy() { bitField0_ = (bitField0_ & ~0x00000040); fileWriteLocationPolicy_ = getDefaultInstance().getFileWriteLocationPolicy(); onChanged(); return this; } /**
result = result && (hasBlockSizeBytes() == other.hasBlockSizeBytes()); if (hasBlockSizeBytes()) { result = result && (getBlockSizeBytes() == other.getBlockSizeBytes()); result = result && (hasRecursive() == other.hasRecursive()); if (hasRecursive()) { result = result && (getRecursive() == other.getRecursive()); result = result && (hasMode() == other.hasMode()); if (hasMode()) { result = result && getMode() .equals(other.getMode()); result = result && (hasReplicationMax() == other.hasReplicationMax()); if (hasReplicationMax()) { result = result && (getReplicationMax() == other.getReplicationMax()); result = result && (hasReplicationMin() == other.hasReplicationMin()); if (hasReplicationMin()) { result = result && (getReplicationMin() == other.getReplicationMin()); result = result && (hasReplicationDurable() == other.hasReplicationDurable()); if (hasReplicationDurable()) { result = result && (getReplicationDurable() == other.getReplicationDurable());
/** * <code>optional .alluxio.grpc.file.CreateFilePOptions options = 2;</code> */ public Builder mergeOptions(alluxio.grpc.CreateFilePOptions value) { if (optionsBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && options_ != null && options_ != alluxio.grpc.CreateFilePOptions.getDefaultInstance()) { options_ = alluxio.grpc.CreateFilePOptions.newBuilder(options_).mergeFrom(value).buildPartial(); } else { options_ = value; } onChanged(); } else { optionsBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**
/** * <code>optional .alluxio.grpc.file.CreateFilePOptions options = 2;</code> */ public alluxio.grpc.CreateFilePOptions getOptions() { return options_ == null ? alluxio.grpc.CreateFilePOptions.getDefaultInstance() : options_; } /**
output.writeMessage(3, getMode()); output.writeMessage(10, getCommonOptions());
/** * Converts a {@link CreateFilePOptions} object to an {@link OpenFilePOptions} object with a * matching Alluxio storage type. * * @param op a {@link CreateFilePOptions} object * @return an {@link OpenFilePOptions} object with a matching Alluxio storage type */ public static OpenFilePOptions toOpenFileOptions(CreateFilePOptions op) { if (WriteType.fromProto(op.getWriteType()).getAlluxioStorageType().isStore()) { return OpenFilePOptions.newBuilder().setReadType(ReadPType.CACHE).build(); } return OpenFilePOptions.newBuilder().setReadType(ReadPType.NO_CACHE).build(); }
/** * <code>optional .alluxio.grpc.file.CreateFilePOptions options = 2;</code> */ public alluxio.grpc.CreateFilePOptionsOrBuilder getOptionsOrBuilder() { return options_ == null ? alluxio.grpc.CreateFilePOptions.getDefaultInstance() : options_; }
.computeMessageSize(3, getMode()); .computeMessageSize(10, getCommonOptions());
hash = (19 * hash) + getDescriptor().hashCode(); if (hasBlockSizeBytes()) { hash = (37 * hash) + BLOCKSIZEBYTES_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getBlockSizeBytes()); if (hasRecursive()) { hash = (37 * hash) + RECURSIVE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getRecursive()); if (hasMode()) { hash = (37 * hash) + MODE_FIELD_NUMBER; hash = (53 * hash) + getMode().hashCode(); if (hasReplicationMax()) { hash = (37 * hash) + REPLICATIONMAX_FIELD_NUMBER; hash = (53 * hash) + getReplicationMax(); if (hasReplicationMin()) { hash = (37 * hash) + REPLICATIONMIN_FIELD_NUMBER; hash = (53 * hash) + getReplicationMin(); if (hasReplicationDurable()) { hash = (37 * hash) + REPLICATIONDURABLE_FIELD_NUMBER; hash = (53 * hash) + getReplicationDurable(); if (hasFileWriteLocationPolicy()) { hash = (37 * hash) + FILEWRITELOCATIONPOLICY_FIELD_NUMBER;
private void writeFile(FileSystem fs) throws IOException, AlluxioException { for (int i = 0; i < mNumFiles; i++) { ByteBuffer buf = ByteBuffer.allocate(80); buf.order(ByteOrder.nativeOrder()); for (int k = 0; k < mNumFiles; k++) { buf.putInt(k); } buf.flip(); AlluxioURI filePath = new AlluxioURI(mFileFolder + "/part-" + i); LOG.debug("Writing data to {}", filePath); OutputStream os = fs.createFile(filePath, CreateFilePOptions.newBuilder().setRecursive(true).build()); os.write(buf.array()); os.close(); } }
public alluxio.grpc.CreateFilePOptions getDefaultInstanceForType() { return alluxio.grpc.CreateFilePOptions.getDefaultInstance(); }
/** * Creates a file at the given path. * * @param fs a filesystem client * @param path the file path */ public static void createFile(FileSystem fs, AlluxioURI path) throws Exception { try (FileOutStream out = fs.createFile(path, CreateFilePOptions.newBuilder() .setBlockSizeBytes(Constants.KB).setRecursive(true).build())) { out.write("test".getBytes()); } }
/** * <code>optional .alluxio.grpc.file.CreateFilePOptions options = 2;</code> */ public alluxio.grpc.CreateFilePOptionsOrBuilder getOptionsOrBuilder() { if (optionsBuilder_ != null) { return optionsBuilder_.getMessageOrBuilder(); } else { return options_ == null ? alluxio.grpc.CreateFilePOptions.getDefaultInstance() : options_; } } /**
/** * Writes a partition. */ public void writePartition() throws IOException, AlluxioException { if (sDebugMode) { mBuf.flip(); LOG.info(FormatUtils.byteBufferToString(mBuf)); } mBuf.flip(); for (int pId = mLeft; pId < mRight; pId++) { final long startTimeMs = System.currentTimeMillis(); FileOutStream os = mFileSystem.createFile(new AlluxioURI(sFileName + (pId + sBaseFileNumber)), CreateFilePOptions.newBuilder().setRecursive(true).build()); for (int k = 0; k < sBlocksPerFile; k++) { mBuf.putInt(0, k + mWorkerId); os.write(mBuf.array()); } os.close(); logPerIteration(startTimeMs, pId, "th WriteAlluxioFile @ Worker ", pId); } }
/** * <code>optional .alluxio.grpc.file.CreateFilePOptions options = 2;</code> */ public alluxio.grpc.CreateFilePOptions getOptions() { if (optionsBuilder_ == null) { return options_ == null ? alluxio.grpc.CreateFilePOptions.getDefaultInstance() : options_; } else { return optionsBuilder_.getMessage(); } } /**
CreateFilePOptions createOptions = CreateFilePOptions.newBuilder() .setFileWriteLocationPolicy(mFsContext.getConf().get( PropertyKey.USER_FILE_COPY_FROM_LOCAL_WRITE_LOCATION_POLICY))