1 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2 package org.rocksdb;
3 
4 /**
5  * The config for skip-list memtable representation.
6  */
7 public class SkipListMemTableConfig extends MemTableConfig {
8 
9   public static final long DEFAULT_LOOKAHEAD = 0;
10 
11   /**
12    * SkipListMemTableConfig constructor
13    */
14   public SkipListMemTableConfig() {
15     lookahead_ = DEFAULT_LOOKAHEAD;
16   }
17 
18   /**
19    * Sets lookahead for SkipList
20    *
21    * @param lookahead If non-zero, each iterator's seek operation
22    *     will start the search from the previously visited record
23    *     (doing at most 'lookahead' steps). This is an
24    *     optimization for the access pattern including many
25    *     seeks with consecutive keys.
26    * @return the current instance of SkipListMemTableConfig
RocksObject(final long nativeHandle)27    */
28   public SkipListMemTableConfig setLookahead(final long lookahead) {
29     lookahead_ = lookahead;
30     return this;
31   }
32 
33   /**
34    * Returns the currently set lookahead value.
35    *
disposeInternal()36    * @return lookahead value
37    */
38   public long lookahead() {
39     return lookahead_;
40   }
41 
42 
43   @Override protected long newMemTableFactoryHandle() {
44     return newMemTableFactoryHandle0(lookahead_);
45   }
46 
47   private native long newMemTableFactoryHandle0(long lookahead)
48       throws IllegalArgumentException;
49 
50   private long lookahead_;
51 }
52