Search in sources :

Example 6 with LockBlockTOptions

use of alluxio.thrift.LockBlockTOptions in project alluxio by Alluxio.

the class LockBlockOptions method toThrift.

/**
   * Converts the object to a {@link LockBlockTOptions} object.
   *
   * @return the thrift lock block options
   */
public LockBlockTOptions toThrift() {
    LockBlockTOptions options = new LockBlockTOptions();
    options.setUfsPath(mUfsPath);
    options.setOffset(mOffset);
    options.setBlockSize(mBlockSize);
    options.setMaxUfsReadConcurrency(mMaxUfsReadConcurrency);
    return options;
}
Also used : LockBlockTOptions(alluxio.thrift.LockBlockTOptions)

Example 7 with LockBlockTOptions

use of alluxio.thrift.LockBlockTOptions in project alluxio by Alluxio.

the class UnderFileSystemBlockReaderTest method before.

@Before
public void before() throws Exception {
    Configuration.set(PropertyKey.UNDERFS_ADDRESS, mFolder.getRoot().getAbsolutePath());
    String testFilePath = mFolder.newFile().getAbsolutePath();
    byte[] buffer = BufferUtils.getIncreasingByteArray((int) TEST_BLOCK_SIZE * 2);
    BufferUtils.writeBufferToFile(testFilePath, buffer);
    mAlluxioBlockStore = Mockito.mock(BlockStore.class);
    mTempBlockMeta = Mockito.mock(TempBlockMeta.class);
    Mockito.when(mAlluxioBlockStore.createBlock(Mockito.anyLong(), Mockito.anyLong(), Mockito.any(BlockStoreLocation.class), Mockito.anyLong())).thenReturn(mTempBlockMeta);
    Mockito.when(mTempBlockMeta.getPath()).thenReturn(mFolder.newFile().getAbsolutePath());
    LockBlockTOptions options = new LockBlockTOptions();
    options.setMaxUfsReadConcurrency(10);
    options.setBlockSize(TEST_BLOCK_SIZE);
    options.setOffset(TEST_BLOCK_SIZE);
    options.setUfsPath(testFilePath);
    mUnderFileSystemBlockMeta = new UnderFileSystemBlockMeta(SESSION_ID, BLOCK_ID, new OpenUfsBlockOptions(options));
}
Also used : UnderFileSystemBlockMeta(alluxio.worker.block.meta.UnderFileSystemBlockMeta) OpenUfsBlockOptions(alluxio.worker.block.options.OpenUfsBlockOptions) TempBlockMeta(alluxio.worker.block.meta.TempBlockMeta) LockBlockTOptions(alluxio.thrift.LockBlockTOptions) Before(org.junit.Before)

Aggregations

LockBlockTOptions (alluxio.thrift.LockBlockTOptions)7 OpenUfsBlockOptions (alluxio.worker.block.options.OpenUfsBlockOptions)4 Test (org.junit.Test)4 AlluxioURI (alluxio.AlluxioURI)2 URIStatus (alluxio.client.file.URIStatus)2 Before (org.junit.Before)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 FileOutStream (alluxio.client.file.FileOutStream)1 CreateFileOptions (alluxio.client.file.options.CreateFileOptions)1 InvalidPathException (alluxio.exception.InvalidPathException)1 AlluxioTException (alluxio.thrift.AlluxioTException)1 UnderFileSystem (alluxio.underfs.UnderFileSystem)1 TempBlockMeta (alluxio.worker.block.meta.TempBlockMeta)1 UnderFileSystemBlockMeta (alluxio.worker.block.meta.UnderFileSystemBlockMeta)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 TException (org.apache.thrift.TException)1