Java Code Examples for org.iq80.leveldb.Options#blockRestartInterval()

The following examples show how to use org.iq80.leveldb.Options#blockRestartInterval() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WarpDB.java    From warp10-platform with Apache License 2.0 6 votes vote down vote up
public Options getOptions() {
  //
  // Clone the current options
  //
  
  Options opt = new Options();
  opt.blockRestartInterval(options.blockRestartInterval());
  opt.blockSize(options.blockSize());
  opt.cacheSize(options.cacheSize());
  opt.comparator(options.comparator());
  opt.compressionType(options.compressionType());
  opt.createIfMissing(options.createIfMissing());
  opt.errorIfExists(options.errorIfExists());
  opt.logger(options.logger());
  opt.maxOpenFiles(options.maxOpenFiles());
  opt.paranoidChecks(options.paranoidChecks());
  opt.verifyChecksums(options.verifyChecksums());
  opt.writeBufferSize(options.writeBufferSize());
  
  return opt;
}
 
Example 2
Source File: LevelDBEntityStoreMixin.java    From attic-polygene-java with Apache License 2.0 4 votes vote down vote up
@Override
public void activateService()
    throws Exception
{
    charset = Charset.forName( "UTF-8" );
    configuration.refresh();
    LevelDBEntityStoreConfiguration config = configuration.get();

    // Choose flavour
    String flavour = config.flavour().get();
    DBFactory factory;
    if( "jni".equalsIgnoreCase( flavour ) )
    {
        factory = newJniDBFactory();
    }
    else if( "java".equalsIgnoreCase( flavour ) )
    {
        factory = newJavaDBFactory();
    }
    else
    {
        factory = newDBFactory();
    }

    // Apply configuration
    Options options = new Options();
    options.createIfMissing( true );
    if( config.blockRestartInterval().get() != null )
    {
        options.blockRestartInterval( config.blockRestartInterval().get() );
    }
    if( config.blockSize().get() != null )
    {
        options.blockSize( config.blockSize().get() );
    }
    if( config.cacheSize().get() != null )
    {
        options.cacheSize( config.cacheSize().get() );
    }
    if( config.compression().get() != null )
    {
        options.compressionType( config.compression().get()
                                 ? CompressionType.SNAPPY
                                 : CompressionType.NONE );
    }
    if( config.maxOpenFiles().get() != null )
    {
        options.maxOpenFiles( config.maxOpenFiles().get() );
    }
    if( config.paranoidChecks().get() != null )
    {
        options.paranoidChecks( config.paranoidChecks().get() );
    }
    if( config.verifyChecksums().get() != null )
    {
        options.verifyChecksums( config.verifyChecksums().get() );
    }
    if( config.writeBufferSize().get() != null )
    {
        options.writeBufferSize( config.writeBufferSize().get() );
    }
    if( config.errorIfExists().get() != null )
    {
        options.errorIfExists( config.errorIfExists().get() );
    }

    // Open/Create the database
    File dbFile = new File( fileConfig.dataDirectory(), descriptor.identity().toString() );
    db = factory.open( dbFile, options );
}