Package org.chaidb.db.index.btree

Examples of org.chaidb.db.index.btree.DataNode


        final PageBufferManager buffer = btree.getBuffer();
        final BTreeSpec btreeSpec = btree.getBTreeSpec();
        PageNumber dupPageNumber = new PageNumber(nodePos.getPageNo());
        try {
            DataPage curDataPage = new DataPage(btree.getBtreeId(), dupPageNumber, btreeSpec, buffer);
            DataNode curDataNode = new DataNode(curDataPage, nodePos.getOffsetInPage());
            curDataNode.setFlags(BTreeSpec.DATA_NODE_DUP_NEXT);
            byte[] oldData = ByteTool.copyByteArray(curDataNode.getPage().getPage(), curDataNode.getNodeOffset(), (int) curDataNode.getNodeSpace());
            byte[] data = new byte[8];
            ByteTool.intToBytes(data, 0, nextNodePos.getOffsetInPage());
            ByteTool.intToBytes(data, 4, nextNodePos.getPageNo());
            curDataNode.storeNode(data, oldData, kContext);
            buffer.releasePage(btree.getBtreeId(), nodePos.getPageNo(), true);
        } catch (ChaiDBException e) {
            logger.error(e);
            buffer.releasePage(btree.getBtreeId(), nodePos.getPageNo(), false);
        }
View Full Code Here


     *         node.nodeNextPosition is updated to the next position after the node,
     *         if the node is dup_next, nodeNextPosition stored the pointer. if link
     *         is end, nodeNextPosition will be null.
     */
    protected int getNode(DataPage dataPage, NodeInfo node) {
        DataNode dupDataNode = new DataNode(dataPage, node.nodePosition.getOffsetInPage());
        int nPageNo = node.nodePosition.getPageNo();
        int nOffset = node.nodePosition.getOffsetInPage();

        try {
            byte[] data = dupDataNode.getData();
            if (dupDataNode.isDupData()) {
                //This node is available value
                node.data = btree.decodeFromByteArray(data, null);
                node.nodeNextPosition = new NodePosition(nPageNo, nOffset + dupDataNode.getNodeSpace());
                return DUP_DATA;
            } else if (dupDataNode.isDupNext()) {
                node.data = null;
                int nextOffset = ByteTool.bytesToInt(data, 0, btree.getBTreeSpec().isMsbFirst());
                int nNextPageNumber = ByteTool.bytesToInt(data, 4, btree.getBTreeSpec().isMsbFirst());
                if ((nextOffset == nOffset) && (nNextPageNumber == nPageNo)) {
                    node.nodeNextPosition = null;
View Full Code Here

TOP

Related Classes of org.chaidb.db.index.btree.DataNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.