Package org.iq80.leveldb

Examples of org.iq80.leveldb.Options


    }

    public void crud(DBFactory firstFactory, DBFactory secondFactory)
            throws IOException, DBException
    {
        Options options = new Options().createIfMissing(true);

        File path = getTestDirectory(getClass().getName() + "_" + NEXT_ID.incrementAndGet());
        DB db = firstFactory.open(path, options);

        WriteOptions wo = new WriteOptions().sync(false);
View Full Code Here


    File getTestDirectory(String name)
            throws IOException
    {
        File rc = new File(databaseDir, name);
        factory.destroy(rc, new Options().createIfMissing(true));
        rc.mkdirs();
        return rc;
    }
View Full Code Here

    @Test
    public void testCompaction()
            throws IOException, DBException
    {
        Options options = new Options().createIfMissing(true).compressionType(CompressionType.NONE);

        File path = getTestDirectory("testCompaction");
        DB db = factory.open(path, options);

        System.out.println("Adding");
View Full Code Here

    @Test
    public void testBackgroundCompaction()
            throws Exception
    {
        Options options = new Options();
        options.maxOpenFiles(100);
        options.createIfMissing(true);
        DbImpl db = new DbImpl(options, this.databaseDir);
        Random random = new Random(301);
        for (int i = 0; i < 200000 * STRESS_FACTOR; i++) {
            db.put(randomString(random, 64).getBytes(), new byte[] {0x01}, new WriteOptions().sync(false));
            db.get(randomString(random, 64).getBytes());
View Full Code Here

    }

    private void open()
            throws IOException
    {
        Options options = new Options();
        options.createIfMissing(!useExisting);
        // todo block cache
        if (writeBufferSize != null) {
            options.writeBufferSize(writeBufferSize);
        }
        db = factory.open(databaseDir, options);
    }
View Full Code Here

        //To change body of created methods use File | Settings | File Templates.
    }

    private void snappyCompress()
    {
        byte[] raw = generator.generate(new Options().blockSize());
        byte[] compressedOutput = new byte[Snappy.maxCompressedLength(raw.length)];

        long produced = 0;

        // attempt to compress the block
View Full Code Here

        message = String.format("(output: %.1f%%)", (produced * 100.0) / bytes);
    }

    private void snappyUncompressArray()
    {
        int inputSize = new Options().blockSize();
        byte[] compressedOutput = new byte[Snappy.maxCompressedLength(inputSize)];
        byte[] raw = generator.generate(inputSize);
        int compressedLength;
        try {
            compressedLength = Snappy.compress(raw, 0, raw.length, compressedOutput, 0);
View Full Code Here

        }
    }

    private void snappyUncompressDirectBuffer()
    {
        int inputSize = new Options().blockSize();
        byte[] compressedOutput = new byte[Snappy.maxCompressedLength(inputSize)];
        byte[] raw = generator.generate(inputSize);
        int compressedLength;
        try {
            compressedLength = Snappy.compress(raw, 0, raw.length, compressedOutput, 0);
View Full Code Here

    protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
        return new SnappyOutputStream(underlying);
    }

    protected InputStream wrapInputStream(InputStream underlying) throws IOException {
        return new SnappyInputStream(underlying);
    }
View Full Code Here

    public String getType() {
        return "snappy";
    }

    protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
        return new SnappyOutputStream(underlying);
    }
View Full Code Here

TOP

Related Classes of org.iq80.leveldb.Options

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.