use of org.sirix.page.CASPage in project sirix by sirixdb.
the class PageWriteTrxImpl method createEntry.
@Override
public Record createEntry(final Long key, final Record record, final PageKind pageKind, final int index, final Optional<UnorderedKeyValuePage> keyValuePage) throws SirixIOException {
mPageRtx.assertNotClosed();
// Allocate record key and increment record count.
long recordKey;
switch(pageKind) {
case RECORDPAGE:
recordKey = mNewRoot.incrementAndGetMaxNodeKey();
break;
case PATHSUMMARYPAGE:
final PathSummaryPage pathSummaryPage = ((PathSummaryPage) mNewRoot.getPathSummaryPageReference().getPage());
recordKey = pathSummaryPage.incrementAndGetMaxNodeKey(index);
break;
case CASPAGE:
final CASPage casPage = ((CASPage) mNewRoot.getCASPageReference().getPage());
recordKey = casPage.incrementAndGetMaxNodeKey(index);
break;
case PATHPAGE:
final PathPage pathPage = ((PathPage) mNewRoot.getPathPageReference().getPage());
recordKey = pathPage.incrementAndGetMaxNodeKey(index);
break;
case NAMEPAGE:
final NamePage namePage = ((NamePage) mNewRoot.getNamePageReference().getPage());
recordKey = namePage.incrementAndGetMaxNodeKey(index);
break;
default:
throw new IllegalStateException();
}
final long recordPageKey = mPageRtx.pageKey(recordKey);
final PageContainer cont = prepareRecordPage(recordPageKey, index, pageKind);
@SuppressWarnings("unchecked") final KeyValuePage<Long, Record> modified = (KeyValuePage<Long, Record>) cont.getModified();
modified.setEntry(record.getNodeKey(), record);
return record;
}
Aggregations