Package xbird.storage.io

Examples of xbird.storage.io.VarSegments$DescriptorBTree


    public void flush(final DbCollection coll, final String docName, final PropertyMap docProps)
            throws IOException {
        final File chunkFile = getChunkFile(coll, docName);
        assert (!chunkFile.exists()) : "file already exists: " + chunkFile.getAbsolutePath();
        final int splen = _strPool.size();
        final Segments paged = new VarSegments(chunkFile, DescriptorType.hash);
        for(int i = 0; i < splen; i++) {// big string
            final byte[] b = _strPool.get(i);
            final int addr = stringKey(i);
            paged.write(addr, b);
        }
        _strPool.clear();
        final long lcclen = _cpointer >> BLOCK_SHIFT;
        assert (lcclen <= Integer.MAX_VALUE) : lcclen;
        final int cclen = Math.min((int) lcclen, _cchunks.length - 1);
        for(int i = 0; i <= cclen; i++) {
            final char[] c = _cchunks[i];
            final byte[] b = compress(compressor, c);
            final long addr = chunkKey(i * DEFAULT_BLOCK_SIZE_L);
            paged.write(addr, b);
            _cchunks[i] = null;
        }
        docProps.setProperty(KEY_STRPOOL_WRITTEN, String.valueOf(splen));
        docProps.setProperty(KEY_CHUNK_WRITTEN, String.valueOf(cclen));
        paged.flush(false);
        close();
        LOG.info("write string chunk file:" + chunkFile.getAbsolutePath());
    }
View Full Code Here


    public void flush(final DbCollection coll, final String docName, final PropertyMap docProps)
            throws IOException {
        final File chunkFile = getChunkFile(coll, docName);
        assert (!chunkFile.exists()) : "file already exists: " + chunkFile.getAbsolutePath();
        final int splen = _strPool.size();
        final Segments paged = new VarSegments(chunkFile, DescriptorType.hash);
        for(int i = 0; i < splen; i++) {// big string
            final String s = _strPool.get(i);
            final byte[] b = compressor.compress(StringUtils.getBytes(s));
            final int addr = stringKey(i);
            paged.write(addr, b);
        }
        _strPool.clear();
        final long lcclen = _cpointer >> BLOCK_SHIFT;
        assert (lcclen <= Integer.MAX_VALUE) : lcclen;
        final int cclen = Math.min((int) lcclen, _cchunks.length - 1);
        for(int i = 0; i <= cclen; i++) {
            final char[] c = _cchunks[i];
            assert (c != null);
            final byte[] b = compress(compressor, c);
            final int addr = chunkKey(i * BLOCK_SIZE);
            paged.write(addr, b);
            _cchunks[i] = null;
        }
        docProps.setProperty(KEY_STRPOOL_WRITTEN, String.valueOf(splen));
        docProps.setProperty(KEY_CHUNK_WRITTEN, String.valueOf(cclen));
        paged.flush(false);
        close();
        LOG.info("write string chunk file:" + chunkFile.getAbsolutePath());
    }
View Full Code Here

    private StringChunkLoader() {}

    public static IStringChunk load(final DbCollection coll) throws IOException {
        PropertyMap props = coll.getCollectionProperties();
        File chunkFile = getChunkFile(coll);
        VarSegments paged = new VarSegments(chunkFile, DescriptorType.hash);
        IStringChunk sc = new PagedStringChunk2(paged, props);
        return sc;
    }
View Full Code Here

    public void flush(final DbCollection coll, final String docName, final PropertyMap docProps)
            throws IOException {
        final File chunkFile = getChunkFile(coll, docName);
        assert (!chunkFile.exists()) : "file already exists: " + chunkFile.getAbsolutePath();
        final int splen = _strPool.size();
        final Segments paged = new VarSegments(chunkFile, DescriptorType.hash);
        for(int i = 0; i < splen; i++) {// big string
            final String s = _strPool.get(i);
            final byte[] b = compressor.compress(StringUtils.getBytes(s));
            final int addr = stringKey(i);
            paged.write(addr, b);
        }
        _strPool.clear();
        final long lcclen = _cpointer >> BLOCK_SHIFT;
        assert (lcclen <= Integer.MAX_VALUE) : lcclen;
        final int cclen = Math.min((int) lcclen, _cchunks.length - 1);
        for(int i = 0; i <= cclen; i++) {
            final char[] c = _cchunks[i];
            assert (c != null);
            final byte[] b = compress(compressor, c);
            final int addr = chunkKey(i * BLOCK_SIZE);
            paged.write(addr, b);
            _cchunks[i] = null;
        }
        docProps.setProperty(KEY_STRPOOL_WRITTEN, String.valueOf(splen));
        docProps.setProperty(KEY_CHUNK_WRITTEN, String.valueOf(cclen));
        paged.flush(false);
        close();
        LOG.info("write string chunk file:" + chunkFile.getAbsolutePath());
    }
View Full Code Here

    public void flush(final DbCollection coll, final String docName, final PropertyMap docProps)
            throws IOException {
        final File chunkFile = getChunkFile(coll, docName);
        assert (!chunkFile.exists()) : "file already exists: " + chunkFile.getAbsolutePath();
        final int splen = _strPool.size();
        final Segments paged = new VarSegments(chunkFile, DescriptorType.hash);
        for(int i = 0; i < splen; i++) {// big string
            final byte[] b = _strPool.get(i);
            final int addr = stringKey(i);
            paged.write(addr, b);
        }
        _strPool.clear();
        final long lcclen = _cpointer >> BLOCK_SHIFT;
        assert (lcclen <= Integer.MAX_VALUE) : lcclen;
        final int cclen = Math.min((int) lcclen, _cchunks.length - 1);
        for(int i = 0; i <= cclen; i++) {
            final char[] c = _cchunks[i];
            final byte[] b = compress(compressor, c);
            final long addr = chunkKey(i * DEFAULT_BLOCK_SIZE_L);
            paged.write(addr, b);
            _cchunks[i] = null;
        }
        docProps.setProperty(KEY_STRPOOL_WRITTEN, String.valueOf(splen));
        docProps.setProperty(KEY_CHUNK_WRITTEN, String.valueOf(cclen));
        paged.flush(false);
        close();
        LOG.info("write string chunk file:" + chunkFile.getAbsolutePath());
    }
View Full Code Here

TOP

Related Classes of xbird.storage.io.VarSegments$DescriptorBTree

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.