Package xbird.storage.index

Examples of xbird.storage.index.BIndexFile


    }

    public void testBFile() throws IOException, DbException {
        File tmpFile = File.createTempFile("bfile", ".tmp");
        tmpFile.deleteOnExit();
        BIndexFile bfile = new BIndexFile(tmpFile, false);
        bfile.create(false);

        List<byte[]> list = new ArrayList<byte[]>(REPEAT);
        Random random = new Random(54552542345L);
        StopWatch sw1 = new StopWatch("[BFileUniq] Index Construction of " + REPEAT);
        for(int i = 0; i < REPEAT; i++) {
            long v = random.nextLong();
            byte[] b = Primitives.toBytes(v);
            Value k = new Value(b);
            bfile.addValue(k, b);
            list.add(b);
        }
        System.err.println(sw1);

        bfile.flush(true, true);

        StopWatch sw2 = new StopWatch("[BFileUniq] Index Search of " + (REPEAT / 2));
        for(int i = REPEAT - 1; i >= 0; i -= 2) {
            byte[] b = list.get(i);
            Assert.assertEquals("#" + i, new Value(b), bfile.getValue(new Value(b)));
        }
        System.err.println(sw2);
        System.err.println("[BFileUniq] " + tmpFile.getAbsolutePath() + " - size: "
                + tmpFile.length());
        bfile.drop();
    }
View Full Code Here


        File pathFile = new File(idxDir, docName + PATHS_FILE_SUFFIX);
        this.pathIndexer = new BTreeIndexer("PathIndexer#" + docName, pathFile, true);

        File labelFile = new File(idxDir, docName + LABEL_FILE_SUFFIX);
        BIndexFile labelBFile = new BIndexFile(labelFile, false);
        try {
            labelBFile.init(true);
        } catch (DbException e) {
            throw new IllegalStateException("failed initializing label BFile: "
                    + labelFile.getAbsolutePath());
        }
        this.labelIndexer = labelBFile;
View Full Code Here

        protected long[] filter(long[] ptrs, String docName, File idxFile) throws XQueryException {
            final int ptrslen = ptrs.length;
            if(ptrslen == 0) {
                return ptrs;
            }
            final BIndexFile labelBFile = getLabelIndex(docName, idxFile);
            final byte[] ancestorLabel = retrieveLabel(labelBFile, ancestorRowId);
            if(ancestorLabel == null) {
                throw new IllegalStateException("label is not registed for ancestor rowID#: "
                        + ancestorRowId);
            }
View Full Code Here

            File labelFile = new File(idxDir, docName + LabelingHandler.LABEL_FILE_SUFFIX);
            if(!labelFile.exists()) {
                throw new IllegalStateException("label idx file does not exist: "
                        + labelFile.getAbsolutePath());
            }
            BIndexFile labelBFile = new BIndexFile(labelFile);
            try {
                labelBFile.open();
            } catch (DbException e) {
                throw new XQueryException("failed to open BFile: " + labelFile.getAbsolutePath(), e);
            }
            return labelBFile;
        }
View Full Code Here

public final class VarSegmentsBFile implements Segments {

    private final BIndexFile bfile;

    public VarSegmentsBFile(File file) {
        final BIndexFile bf = new BIndexFile(file, false);
        try {
            bf.init(false);
        } catch (DbException e) {
            throw new IllegalStateException("failed on initializing BFile: "
                    + file.getAbsolutePath(), e);
        }
        this.bfile = bf;
View Full Code Here

        File pathFile = new File(idxDir, docName + PATHS_FILE_SUFFIX);
        this.pathIndexer = new BTreeIndexer("PathIndexer#" + docName, pathFile, true);

        File labelFile = new File(idxDir, docName + LABEL_FILE_SUFFIX);
        BIndexFile labelBFile = new BIndexFile(labelFile, false);
        try {
            labelBFile.init(true);
        } catch (DbException e) {
            throw new IllegalStateException("failed initializing label BFile: "
                    + labelFile.getAbsolutePath());
        }
        this.labelIndexer = labelBFile;
View Full Code Here

public final class VarSegmentsBFile implements Segments {

    private final BIndexFile bfile;

    public VarSegmentsBFile(File file) {
        final BIndexFile bf = new BIndexFile(file, false);
        try {
            bf.init(false);
        } catch (DbException e) {
            throw new IllegalStateException("failed on initializing BFile: "
                    + file.getAbsolutePath(), e);
        }
        this.bfile = bf;
View Full Code Here

TOP

Related Classes of xbird.storage.index.BIndexFile

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.