Search in sources :

Example 1 with DeletedNode

use of org.sirix.node.DeletedNode in project sirix by sirixdb.

the class PageWriteTrxImpl method removeEntry.

@Override
public void removeEntry(final Long recordKey, @Nonnull final PageKind pageKind, final int index, final Optional<UnorderedKeyValuePage> keyValuePage) throws SirixIOException {
    mPageRtx.assertNotClosed();
    final long nodePageKey = mPageRtx.pageKey(recordKey);
    final PageContainer cont = prepareRecordPage(nodePageKey, index, pageKind);
    final Optional<Record> node = getRecord(recordKey, pageKind, index);
    if (node.isPresent()) {
        final Record nodeToDel = node.get();
        final Node delNode = new DeletedNode(new NodeDelegate(nodeToDel.getNodeKey(), -1, -1, -1, Optional.<SirixDeweyID>empty()));
        ((UnorderedKeyValuePage) cont.getModified()).setEntry(delNode.getNodeKey(), delNode);
        ((UnorderedKeyValuePage) cont.getComplete()).setEntry(delNode.getNodeKey(), delNode);
    } else {
        throw new IllegalStateException("Node not found!");
    }
}
Also used : PageContainer(org.sirix.cache.PageContainer) Node(org.sirix.node.interfaces.Node) DeletedNode(org.sirix.node.DeletedNode) Record(org.sirix.node.interfaces.Record) DeletedNode(org.sirix.node.DeletedNode) UnorderedKeyValuePage(org.sirix.page.UnorderedKeyValuePage) SirixDeweyID(org.sirix.node.SirixDeweyID) NodeDelegate(org.sirix.node.delegates.NodeDelegate)

Aggregations

PageContainer (org.sirix.cache.PageContainer)1 DeletedNode (org.sirix.node.DeletedNode)1 SirixDeweyID (org.sirix.node.SirixDeweyID)1 NodeDelegate (org.sirix.node.delegates.NodeDelegate)1 Node (org.sirix.node.interfaces.Node)1 Record (org.sirix.node.interfaces.Record)1 UnorderedKeyValuePage (org.sirix.page.UnorderedKeyValuePage)1