Search in sources :

Example 1 with StorageTierEvictorView

use of alluxio.worker.block.meta.StorageTierEvictorView in project alluxio by Alluxio.

the class BlockMetadataViewTest method sameTierView.

/**
 * Tests that {@code BlockMetadataEvictorView.getTierView(tierAlias)} returns the same
 * TierView as {@code new StorageTierEvictorView(mMetadataManager.getTier(tierAlias), this)}.
 */
@Test
public void sameTierView() {
    String tierAlias = mMetaManager.getTiers().get(TEST_TIER_ORDINAL).getTierAlias();
    StorageTierView tierView1 = mMetadataView.getTierView(tierAlias);
    // Do some operations on metadata
    StorageDir dir = mMetaManager.getTiers().get(TEST_TIER_ORDINAL).getDir(TEST_DIR);
    BlockMeta blockMeta = new DefaultBlockMeta(TEST_BLOCK_ID, TEST_BLOCK_SIZE, dir);
    try {
        dir.addBlockMeta(blockMeta);
    } catch (Exception e) {
        e.printStackTrace();
    }
    StorageTierEvictorView tierView2 = new StorageTierEvictorView(mMetaManager.getTier(tierAlias), mMetadataView);
    assertSameTierView((StorageTierEvictorView) tierView1, tierView2);
}
Also used : StorageTierEvictorView(alluxio.worker.block.meta.StorageTierEvictorView) DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) StorageTierView(alluxio.worker.block.meta.StorageTierView) StorageDir(alluxio.worker.block.meta.StorageDir) BlockMeta(alluxio.worker.block.meta.BlockMeta) DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) ExpectedException(org.junit.rules.ExpectedException) BlockDoesNotExistException(alluxio.exception.BlockDoesNotExistException) Test(org.junit.Test)

Example 2 with StorageTierEvictorView

use of alluxio.worker.block.meta.StorageTierEvictorView in project alluxio by Alluxio.

the class BlockMetadataEvictorView method initializeView.

@Override
protected void initializeView() {
    // iteratively create all StorageTierViews and StorageDirViews
    for (StorageTier tier : mMetadataManager.getTiers()) {
        StorageTierEvictorView tierView = new StorageTierEvictorView(tier, this);
        mTierViews.add(tierView);
        mAliasToTierViews.put(tier.getTierAlias(), tierView);
    }
}
Also used : StorageTierEvictorView(alluxio.worker.block.meta.StorageTierEvictorView) StorageTier(alluxio.worker.block.meta.StorageTier)

Example 3 with StorageTierEvictorView

use of alluxio.worker.block.meta.StorageTierEvictorView in project alluxio by Alluxio.

the class BlockMetadataViewTest method sameTierViewsBelow.

/**
 * Tests that {@link BlockMetadataEvictorView#getTierViewsBelow(String)} returns the same
 * TierViews as constructing by {@link BlockMetadataManager#getTiersBelow(String)}.
 */
@Test
public void sameTierViewsBelow() {
    String tierAlias = mMetaManager.getTiers().get(TEST_TIER_ORDINAL).getTierAlias();
    List<StorageTierView> tierViews1 = mMetadataView.getTierViewsBelow(tierAlias);
    // Do some operations on metadata
    StorageDir dir = mMetaManager.getTiers().get(TEST_TIER_ORDINAL + 1).getDir(TEST_DIR);
    BlockMeta blockMeta = new DefaultBlockMeta(TEST_BLOCK_ID, TEST_BLOCK_SIZE, dir);
    try {
        dir.addBlockMeta(blockMeta);
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<StorageTier> tiers2 = mMetaManager.getTiersBelow(tierAlias);
    assertEquals(tierViews1.size(), tiers2.size());
    for (int i = 0; i < tierViews1.size(); i++) {
        assertSameTierView((StorageTierEvictorView) tierViews1.get(i), new StorageTierEvictorView(tiers2.get(i), mMetadataView));
    }
}
Also used : StorageTierEvictorView(alluxio.worker.block.meta.StorageTierEvictorView) DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) StorageTier(alluxio.worker.block.meta.StorageTier) StorageTierView(alluxio.worker.block.meta.StorageTierView) StorageDir(alluxio.worker.block.meta.StorageDir) BlockMeta(alluxio.worker.block.meta.BlockMeta) DefaultBlockMeta(alluxio.worker.block.meta.DefaultBlockMeta) ExpectedException(org.junit.rules.ExpectedException) BlockDoesNotExistException(alluxio.exception.BlockDoesNotExistException) Test(org.junit.Test)

Aggregations

StorageTierEvictorView (alluxio.worker.block.meta.StorageTierEvictorView)3 BlockDoesNotExistException (alluxio.exception.BlockDoesNotExistException)2 BlockMeta (alluxio.worker.block.meta.BlockMeta)2 DefaultBlockMeta (alluxio.worker.block.meta.DefaultBlockMeta)2 StorageDir (alluxio.worker.block.meta.StorageDir)2 StorageTier (alluxio.worker.block.meta.StorageTier)2 StorageTierView (alluxio.worker.block.meta.StorageTierView)2 Test (org.junit.Test)2 ExpectedException (org.junit.rules.ExpectedException)2