/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.contrib.streaming.state;

import org.rocksdb.ColumnFamilyOptions;
import org.rocksdb.DBOptions;

/**
 * A factory for {@link DBOptions} to be passed to the {@link RocksDBStateBackend}.
 * Options have to be created lazily by this factory, because the {@code Options}
 * class is not serializable and holds pointers to native code.
 *
 * <p>A typical pattern to use this OptionsFactory is as follows:
 *
 * <h3>Java 8:</h3>
 * <pre>{@code
 * rocksDbBackend.setOptions( (currentOptions) -> currentOptions.setMaxOpenFiles(1024) );
 * }</pre>
 *
 * <h3>Java 7:</h3>
 * <pre>{@code
 * rocksDbBackend.setOptions(new OptionsFactory() {
 *
 *     public Options setOptions(Options currentOptions) {
 *         return currentOptions.setMaxOpenFiles(1024);
 *     }
 * })
 * }</pre>
 */
public interface OptionsFactory extends java.io.Serializable {

	/**
	 * This method should set the additional options on top of the current options object.
	 * The current options object may contain pre-defined options based on flags that have
	 * been configured on the state backend.
	 *
	 * <p>It is important to set the options on the current object and return the result from
	 * the setter methods, otherwise the pre-defined options may get lost.
	 *
	 * @param currentOptions The options object with the pre-defined options.
	 * @return The options object on which the additional options are set.
	 */
	DBOptions createDBOptions(DBOptions currentOptions);

	/**
	 * This method should set the additional options on top of the current options object.
	 * The current options object may contain pre-defined options based on flags that have
	 * been configured on the state backend.
	 *
	 * <p>It is important to set the options on the current object and return the result from
	 * the setter methods, otherwise the pre-defined options may get lost.
	 *
	 * @param currentOptions The options object with the pre-defined options.
	 * @return The options object on which the additional options are set.
	 */
	ColumnFamilyOptions createColumnOptions(ColumnFamilyOptions currentOptions);

}

@@ -956,16 +956,48 @@
 Options%7D
+ and %7B@link ColumnFamilyOptions%7D
  to be p
@@ -1260,28 +1260,8 @@
 %0A *%0A
- * %3Ch3%3EJava 8:%3C/h3%3E%0A
  * %3C
@@ -1300,18 +1300,88 @@
 Options(
+new OptionsFactory()%7B%0A *%0A *%09%09public DBOptions createDBOptions(DBOptions
  
-(
 currentO
@@ -1392,10 +1392,22 @@
 ns) 
--%3E
+%7B%0A *%09%09%09return 
  cur
@@ -1443,149 +1443,82 @@
 024)
- )
 ;%0A *
- %7D%3C/pre%3E%0A *%0A * %3Ch3%3EJava 7:%3C/h3%3E%0A * %3Cpre%3E%7B@code%0A * rocksDbBackend.setOptions(new OptionsFactory() %7B%0A *%0A *     public Options setOptions(
+%09%09%7D%0A *%0A *%09%09public ColumnFamilyOptions createColumnOptions(ColumnFamily
 Opti
@@ -1545,17 +1545,11 @@
 %7B%0A *
-         
+%09%09%09
 retu
@@ -1573,42 +1573,60 @@
 .set
-MaxOpenFiles(1024);%0A *     
+CompactionStyle(CompactionStyle.LEVEL);%0A *%09%09
 %7D%0A * %7D)
+;
 %0A * 

Update OptionsFactory javadocs