gpt4 book ai didi

alluxio.client.WriteType类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 19:27:05 25 4
gpt4 key购买 nike

本文整理了Java中alluxio.client.WriteType类的一些代码示例,展示了WriteType类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WriteType类的具体详情如下:
包路径:alluxio.client.WriteType
类名称:WriteType

WriteType介绍

[英]Write types for creating a file in Alluxio.
[中]写入用于在Alluxio中创建文件的类型。

代码示例

代码示例来源:origin: Alluxio/alluxio

private WritePType getS3WriteType() {
 return ServerConfiguration.getEnum(PropertyKey.PROXY_S3_WRITE_TYPE, WriteType.class).toProto();
}

代码示例来源:origin: Alluxio/alluxio

/**
 * @return the Alluxio storage type
 */
public AlluxioStorageType getAlluxioStorageType() {
 return mWriteType.getAlluxioStorageType();
}

代码示例来源:origin: Alluxio/alluxio

/**
 * @return the under storage type
 */
public UnderStorageType getUnderStorageType() {
 return mWriteType.getUnderStorageType();
}

代码示例来源:origin: Alluxio/alluxio

/**
 * @return the {@link alluxio.client.UnderStorageType} which is associated with this mode
 */
public UnderStorageType getUnderStorageType() {
 if (isThrough()) {
  return UnderStorageType.SYNC_PERSIST;
 } else if (isAsync()) {
  return UnderStorageType.ASYNC_PERSIST;
 }
 return UnderStorageType.NO_PERSIST;
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Creates context with given option data.
 *
 * @param optionsBuilder the options builder
 */
protected CreatePathContext(T optionsBuilder) {
 super(optionsBuilder);
 mMountPoint = false;
 mOperationTimeMs = System.currentTimeMillis();
 mAcl = Collections.emptyList();
 mMetadataLoad = false;
 mGroup = "";
 mOwner = "";
 if (SecurityUtils.isAuthenticationEnabled(ServerConfiguration.global())) {
  mOwner = SecurityUtils.getOwnerFromGrpcClient(ServerConfiguration.global());
  mGroup = SecurityUtils.getGroupFromGrpcClient(ServerConfiguration.global());
 }
 // Initialize mPersisted based on proto write type.
 WritePType writeType = WritePType.NONE;
 if (optionsBuilder instanceof CreateFilePOptions.Builder) {
  writeType = ((CreateFilePOptions.Builder) optionsBuilder).getWriteType();
 } else if (optionsBuilder instanceof CreateDirectoryPOptions.Builder) {
  writeType = ((CreateDirectoryPOptions.Builder) optionsBuilder).getWriteType();
 }
 mPersisted = WriteType.fromProto(writeType).isThrough();
}

代码示例来源:origin: Alluxio/alluxio

/**
 * {@inheritDoc}
 *
 * Moves the file specified in the config to the configured path. If the destination path is a
 * directory, the file is moved inside that directory.
 */
@Override
public SerializableVoid runTask(MoveConfig config, ArrayList<MoveCommand> commands,
  JobWorkerContext jobWorkerContext) throws Exception {
 WriteType writeType = config.getWriteType() == null
   ? ServerConfiguration.getEnum(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class)
   : WriteType.valueOf(config.getWriteType());
 for (MoveCommand command : commands) {
  move(command, writeType.toProto(), mFileSystem);
 }
 // Try to delete the source directory if it is empty.
 if (!hasFiles(new AlluxioURI(config.getSource()), mFileSystem)) {
  try {
   LOG.debug("Deleting {}", config.getSource());
   mFileSystem.delete(new AlluxioURI(config.getSource()),
     DeletePOptions.newBuilder().setRecursive(true).build());
  } catch (FileDoesNotExistException e) {
   // It's already deleted, possibly by another worker.
  }
 }
 return null;
}

代码示例来源:origin: Alluxio/alluxio

/**
 * 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();
}

代码示例来源:origin: Alluxio/alluxio

assertEquals(TtlAction.FREE, options.getTtlAction());
assertEquals(writeTier, options.getWriteTier());
assertEquals(writeType.getAlluxioStorageType(), options.getAlluxioStorageType());
assertEquals(writeType.getUnderStorageType(), options.getUnderStorageType());

代码示例来源:origin: Alluxio/alluxio

/**
  * Runs the task.
  *
  * @param configSource {@link MoveConfig} source
  * @param commandSource {@link MoveCommand} source
  * @param commandDestination {@link MoveCommand} destination
  * @param writeType {@link MoveConfig} writeType
  */
 private void runTask(String configSource, String commandSource, String commandDestination,
   WriteType writeType) throws Exception {
  new MoveDefinition(mMockFileSystemContext, mMockFileSystem).runTask(
    new MoveConfig(configSource, "", writeType.toString(), false),
    Lists.newArrayList(new MoveCommand(commandSource, commandDestination)),
    new JobWorkerContext(1, 1, mMockUfsManager));
 }
}

代码示例来源:origin: Alluxio/alluxio

mWriteType = WriteType.fromProto(options.getWriteType());

代码示例来源:origin: Alluxio/alluxio

/**
 * @param writePType proto type
 * @return wire type for given proto type
 */
public static WriteType fromProto(WritePType writePType) {
 return WriteType.values()[writePType.getNumber() - 1];
}

代码示例来源:origin: Alluxio/alluxio

/**
 * @return the {@link AlluxioStorageType} which is associated with this mode
 */
public AlluxioStorageType getAlluxioStorageType() {
 if (isCache()) {
  return AlluxioStorageType.STORE;
 }
 return AlluxioStorageType.NO_STORE;
}

代码示例来源:origin: Alluxio/alluxio

mReadType == null ? READ_TYPES : Lists.newArrayList(ReadType.valueOf(mReadType));
List<WriteType> writeTypes =
  mWriteType == null ? WRITE_TYPES : Lists.newArrayList(WriteType.valueOf(mWriteType));
List<OperationType> operations = mOperation == null ? Lists.newArrayList(OperationType.values())
  : Lists.newArrayList(OperationType.valueOf(mOperation));

代码示例来源:origin: org.alluxio/alluxio-core-client-internal

/**
 * @return the {@link alluxio.client.UnderStorageType} which is associated with this mode
 */
public UnderStorageType getUnderStorageType() {
 if (isThrough()) {
  return UnderStorageType.SYNC_PERSIST;
 } else if (isAsync()) {
  return UnderStorageType.ASYNC_PERSIST;
 }
 return UnderStorageType.NO_PERSIST;
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests that building an {@link OutStreamOptions} with the defaults works.
 */
@Test
public void defaults() throws IOException {
 AlluxioStorageType alluxioType = AlluxioStorageType.STORE;
 UnderStorageType ufsType = UnderStorageType.SYNC_PERSIST;
 mConf.set(PropertyKey.USER_BLOCK_SIZE_BYTES_DEFAULT, "64MB");
 mConf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.CACHE_THROUGH.toString());
 mConf.set(PropertyKey.USER_FILE_WRITE_TIER_DEFAULT, Constants.LAST_TIER);
 OutStreamOptions options = OutStreamOptions.defaults(mConf);
 assertEquals(alluxioType, options.getAlluxioStorageType());
 assertEquals(64 * Constants.MB, options.getBlockSizeBytes());
 assertTrue(options.getLocationPolicy() instanceof LocalFirstPolicy);
 assertEquals("test_user", options.getOwner());
 assertEquals("test_group", options.getGroup());
 assertEquals(ModeUtils.applyFileUMask(Mode.defaults(),
   mConf.get(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK)), options.getMode());
 assertEquals(Constants.NO_TTL, options.getTtl());
 assertEquals(TtlAction.DELETE, options.getTtlAction());
 assertEquals(ufsType, options.getUnderStorageType());
 assertEquals(WriteType.CACHE_THROUGH, options.getWriteType());
 assertEquals(Constants.LAST_TIER, options.getWriteTier());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests that the number of bytes written is correct when the stream is created with different
 * under storage types.
 */
@Test
public void getBytesWrittenWithDifferentUnderStorageType() throws IOException {
 for (WriteType type : WriteType.values()) {
  OutStreamOptions options =
    OutStreamOptions.defaults(sConf).setBlockSizeBytes(BLOCK_LENGTH).setWriteType(type)
      .setUfsPath(FILE_NAME.getPath());
  mTestStream = createTestStream(FILE_NAME, options);
  mTestStream.write(BufferUtils.getIncreasingByteArray((int) BLOCK_LENGTH));
  mTestStream.flush();
  Assert.assertEquals(BLOCK_LENGTH, mTestStream.getBytesWritten());
 }
}

代码示例来源:origin: org.alluxio/alluxio-core-client-internal

/**
 * @return the {@link AlluxioStorageType} which is associated with this mode
 */
public AlluxioStorageType getAlluxioStorageType() {
 if (isCache()) {
  return AlluxioStorageType.STORE;
 }
 return AlluxioStorageType.NO_STORE;
}

代码示例来源:origin: org.alluxio/alluxio-examples

mReadType == null ? READ_TYPES : Lists.newArrayList(ReadType.valueOf(mReadType));
List<WriteType> writeTypes =
  mWriteType == null ? WRITE_TYPES : Lists.newArrayList(WriteType.valueOf(mWriteType));
List<OperationType> operations = mOperation == null ? Lists.newArrayList(OperationType.values())
  : Lists.newArrayList(OperationType.valueOf(mOperation));

代码示例来源:origin: Alluxio/alluxio

/**
 * @param filePath the path for the files
 * @param readType the {@link ReadPType}
 * @param writeType the {@link WritePType}
 * @param fsContext the {@link FileSystemContext } to use for client operations
 */
public BasicOperations(AlluxioURI filePath, ReadType readType, WriteType writeType,
  FileSystemContext fsContext) {
 mFilePath = filePath;
 mReadOptions = OpenFilePOptions.newBuilder().setReadType(readType.toProto()).build();
 mWriteOptions = CreateFilePOptions.newBuilder().setWriteType(writeType.toProto())
   .setRecursive(true).build();
 mFsContext = fsContext;
}

代码示例来源:origin: org.alluxio/alluxio-core-client-internal

/**
 * @return the under storage type
 */
public UnderStorageType getUnderStorageType() {
 return mWriteType.getUnderStorageType();
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com