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);
}
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);
}
}
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));
}
}
Aggregations