use of com.revolsys.io.page.FileMappedPageManager in project com.revolsys.open by revolsys.
the class BPlusTreeMap method newTempDisk.
public static <K extends Comparable<K>, V> Map<K, V> newTempDisk(PageValueManager<K> keyManager, PageValueManager<V> valueManager) {
final File file = FileUtil.newTempFile("temp", ".bplustree");
final PageManager pageManager = new FileMappedPageManager(file);
if (keyManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<K> serializeableManager = (SerializablePageValueManager<K>) keyManager;
keyManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
if (valueManager instanceof SerializablePageValueManager) {
final SerializablePageValueManager<V> serializeableManager = (SerializablePageValueManager<V>) valueManager;
valueManager = BPlusTreePageValueManager.newPageValueManager(pageManager, serializeableManager);
}
final Comparator<K> comparator = new ComparableComparator<>();
final BPlusTreeMap<K, V> map = new BPlusTreeMap<>(pageManager, comparator, keyManager, valueManager);
return map;
}
Aggregations