Package org.chaidb.db.index

Examples of org.chaidb.db.index.IDBIndex


    public BTree openBTree(String filename, BTreeType btreeType) throws ChaiDBException {
        if (openedBTree.containsKey(filename)) {
            return (BTree)openedBTree.get(filename);
        }
        String path = DbEnvironment.getDataHome().concat(filename);
        IDBIndex index = BTreeFactory.createBTree(btreeType.typeId);
        index.open(path, kc);
        BTree bTree = new BTree(this, index, btreeType, kc);
        openedBTree.put(filename, bTree);
        btree2Path.put(bTree, filename);
        return bTree;
    }
View Full Code Here


     * @return
     * @throws ChaiDBException
     */
    public BTreeSpec getBTreeSpec(int treeId, short btreeType) throws ChaiDBException {
        try {
            IDBIndex tree;
            BTreeSpec treeSpec = null;

            if (btreeName2Id.getBTreeName(treeId) == null) {
                tree = BTreeFactory.createBTree(btreeType);

                String btreeFileName = retrieveBTreeFileName(treeId);
                tree.openForRecovery(btreeFileName, treeId);

                if (tree instanceof IBTree) {
                    IBTree tmpTree = (IBTree) tree;
                    treeSpec = tmpTree.getBTreeSpec();
                }
View Full Code Here

     */
    public BTreeSpec getBTreeSpec(String btreeFileName, short btreeType, KernelContext kc) throws ChaiDBException {
        try {
            Integer tID;
            int tid;
            IDBIndex tree;
            BTreeSpec treeSpec = null;

            if ((tID = btreeName2Id.getBTreeId(btreeFileName)) == null) {
                //                tree = new BTree();
                tree = BTreeFactory.createBTree(btreeType);
                tree.open(btreeFileName, kc);

                if (tree instanceof IBTree) {
                    IBTree tmpTree = (IBTree) tree;
                    tid = tmpTree.getBtreeId();
                    treeSpec = tmpTree.getBTreeSpec();
View Full Code Here

     * (2) if (1) fail, load BTree from disk
     * (3) if (2) fail too, create BTree and load it in buffer
     * todo fix new btree() problem
     */
    public byte[] getPage(int txnId, int treeId, short btreeType, int pgno, boolean redo, ArrayList locks) throws ChaiDBException {
        IDBIndex tree;

        if (btreeName2Id.getBTreeName(treeId) == null) {
            tree = BTreeFactory.createBTree(btreeType);

            String btreeFileName = retrieveBTreeFileName(treeId);
            tree.openForRecovery(btreeFileName, treeId);
        }

        PageNumber p = new PageNumber(pgno);
        p.setTreeId(treeId);

View Full Code Here

        if (oldBTreeFileName == null || oldBTreeFileName.length() == 0) {
            throw new ChaiDBException(ErrorCode.RUNTIME_ERROR_BASE, "oldBTreeFileName is null");
        }
        short btreeType = getBTreeTypeFromBTreeName(oldBTreeFileName);

        IDBIndex oldBTree = BTreeFactory.createBTree(btreeType);
        oldBTree.open(oldBTreeFileName, kContext);
        IDBIndex clonedBTree = oldBTree.clone(dir, kContext);
        oldBTree.close();
        clonedBTree.close();
    }
View Full Code Here

TOP

Related Classes of org.chaidb.db.index.IDBIndex

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.