use of alluxio.client.file.cache.PageInfo in project alluxio by Alluxio.
the class PageStoreTest method getPages.
@Test
public void getPages() throws Exception {
int len = 32;
int count = 16;
byte[] data = BufferUtils.getIncreasingByteArray(len);
Set<PageInfo> pages = new HashSet<>(count);
for (int i = 0; i < count; i++) {
PageId id = new PageId("0", i);
mPageStore.put(id, data);
pages.add(new PageInfo(id, data.length));
}
Set<PageInfo> restored = mPageStore.getPages().collect(Collectors.toSet());
assertEquals(pages, restored);
}
use of alluxio.client.file.cache.PageInfo in project alluxio by Alluxio.
the class PageStoreTest method getPagesUUID.
@Test
public void getPagesUUID() throws Exception {
int len = 32;
int count = 16;
byte[] data = BufferUtils.getIncreasingByteArray(len);
Set<PageInfo> pages = new HashSet<>(count);
for (int i = 0; i < count; i++) {
PageId id = new PageId(UUID.randomUUID().toString(), i);
mPageStore.put(id, data);
pages.add(new PageInfo(id, data.length));
}
Set<PageInfo> restored = mPageStore.getPages().collect(Collectors.toSet());
assertEquals(pages, restored);
}
use of alluxio.client.file.cache.PageInfo in project alluxio by Alluxio.
the class LocalPageStore method getPageInfo.
/**
* @param path path of a file
* @return the corresponding page info for the file otherwise null
*/
@Nullable
private PageInfo getPageInfo(Path path) {
PageId pageId = getPageId(path);
long pageSize;
if (pageId == null) {
LOG.error("Unrecognized page file" + path);
return null;
}
try {
pageSize = Files.size(path);
} catch (IOException e) {
LOG.error("Failed to get file size for " + path, e);
return null;
}
return new PageInfo(pageId, pageSize);
}