コード例 #1
0
  @Test
  public void testPredefinedOptions() throws Exception {
    RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);

    assertEquals(PredefinedOptions.DEFAULT, rocksDbBackend.getPredefinedOptions());

    rocksDbBackend.setPredefinedOptions(PredefinedOptions.SPINNING_DISK_OPTIMIZED);
    assertEquals(PredefinedOptions.SPINNING_DISK_OPTIMIZED, rocksDbBackend.getPredefinedOptions());

    Options opt1 = rocksDbBackend.getRocksDBOptions();
    Options opt2 = rocksDbBackend.getRocksDBOptions();

    assertEquals(opt1, opt2);

    assertEquals(CompactionStyle.LEVEL, opt1.compactionStyle());
  }
コード例 #2
0
  @Test
  public void testPredefinedAndOptionsFactory() throws Exception {
    RocksDBStateBackend rocksDbBackend = new RocksDBStateBackend(TEMP_URI);

    assertEquals(PredefinedOptions.DEFAULT, rocksDbBackend.getPredefinedOptions());

    rocksDbBackend.setPredefinedOptions(PredefinedOptions.SPINNING_DISK_OPTIMIZED);
    rocksDbBackend.setOptions(
        new OptionsFactory() {
          @Override
          public Options createOptions(Options currentOptions) {
            return currentOptions.setCompactionStyle(CompactionStyle.UNIVERSAL);
          }
        });

    assertEquals(PredefinedOptions.SPINNING_DISK_OPTIMIZED, rocksDbBackend.getPredefinedOptions());
    assertNotNull(rocksDbBackend.getOptions());
    assertEquals(CompactionStyle.UNIVERSAL, rocksDbBackend.getRocksDBOptions().compactionStyle());
  }