1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 package org.rocksdb;
7 
8 import java.nio.file.Paths;
9 import java.util.*;
10 
11 /**
12  * DBOptions to control the behavior of a database.  It will be used
13  * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
14  *
15  * If {@link #dispose()} function is not called, then it will be GC'd
16  * automatically and native resources will be released as part of the process.
17  */
18 public class DBOptions extends RocksObject
19     implements DBOptionsInterface<DBOptions>,
20     MutableDBOptionsInterface<DBOptions> {
21   static {
RocksDB.loadLibrary()22     RocksDB.loadLibrary();
23   }
24 
25   /**
26    * Construct DBOptions.
27    *
28    * This constructor will create (by allocating a block of memory)
29    * an {@code rocksdb::DBOptions} in the c++ side.
30    */
DBOptions()31   public DBOptions() {
32     super(newDBOptions());
33     numShardBits_ = DEFAULT_NUM_SHARD_BITS;
34   }
35 
36   /**
37    * Copy constructor for DBOptions.
38    *
39    * NOTE: This does a shallow copy, which means env, rate_limiter, sst_file_manager,
40    * info_log and other pointers will be cloned!
41    *
42    * @param other The DBOptions to copy.
43    */
DBOptions(DBOptions other)44   public DBOptions(DBOptions other) {
45     super(copyDBOptions(other.nativeHandle_));
46     this.env_ = other.env_;
47     this.numShardBits_ = other.numShardBits_;
48     this.rateLimiter_ = other.rateLimiter_;
49     this.rowCache_ = other.rowCache_;
50     this.walFilter_ = other.walFilter_;
51     this.writeBufferManager_ = other.writeBufferManager_;
52   }
53 
54   /**
55    * Constructor from Options
56    *
57    * @param options The options.
58    */
DBOptions(final Options options)59   public DBOptions(final Options options) {
60     super(newDBOptionsFromOptions(options.nativeHandle_));
61   }
62 
63   /**
64    * <p>Method to get a options instance by using pre-configured
65    * property values. If one or many values are undefined in
66    * the context of RocksDB the method will return a null
67    * value.</p>
68    *
69    * <p><strong>Note</strong>: Property keys can be derived from
70    * getter methods within the options class. Example: the method
71    * {@code allowMmapReads()} has a property key:
72    * {@code allow_mmap_reads}.</p>
73    *
74    * @param properties {@link java.util.Properties} instance.
75    *
76    * @return {@link org.rocksdb.DBOptions instance}
77    *     or null.
78    *
79    * @throws java.lang.IllegalArgumentException if null or empty
80    *     {@link java.util.Properties} instance is passed to the method call.
81    */
getDBOptionsFromProps( final Properties properties)82   public static DBOptions getDBOptionsFromProps(
83       final Properties properties) {
84     if (properties == null || properties.size() == 0) {
85       throw new IllegalArgumentException(
86           "Properties value must contain at least one value.");
87     }
88     DBOptions dbOptions = null;
89     StringBuilder stringBuilder = new StringBuilder();
90     for (final String name : properties.stringPropertyNames()){
91       stringBuilder.append(name);
92       stringBuilder.append("=");
93       stringBuilder.append(properties.getProperty(name));
94       stringBuilder.append(";");
95     }
96     long handle = getDBOptionsFromProps(
97         stringBuilder.toString());
98     if (handle != 0){
99       dbOptions = new DBOptions(handle);
100     }
101     return dbOptions;
102   }
103 
104   @Override
optimizeForSmallDb()105   public DBOptions optimizeForSmallDb() {
106     optimizeForSmallDb(nativeHandle_);
107     return this;
108   }
109 
110   @Override
setIncreaseParallelism( final int totalThreads)111   public DBOptions setIncreaseParallelism(
112       final int totalThreads) {
113     assert(isOwningHandle());
114     setIncreaseParallelism(nativeHandle_, totalThreads);
115     return this;
116   }
117 
118   @Override
setCreateIfMissing(final boolean flag)119   public DBOptions setCreateIfMissing(final boolean flag) {
120     assert(isOwningHandle());
121     setCreateIfMissing(nativeHandle_, flag);
122     return this;
123   }
124 
125   @Override
createIfMissing()126   public boolean createIfMissing() {
127     assert(isOwningHandle());
128     return createIfMissing(nativeHandle_);
129   }
130 
131   @Override
setCreateMissingColumnFamilies( final boolean flag)132   public DBOptions setCreateMissingColumnFamilies(
133       final boolean flag) {
134     assert(isOwningHandle());
135     setCreateMissingColumnFamilies(nativeHandle_, flag);
136     return this;
137   }
138 
139   @Override
createMissingColumnFamilies()140   public boolean createMissingColumnFamilies() {
141     assert(isOwningHandle());
142     return createMissingColumnFamilies(nativeHandle_);
143   }
144 
145   @Override
setErrorIfExists( final boolean errorIfExists)146   public DBOptions setErrorIfExists(
147       final boolean errorIfExists) {
148     assert(isOwningHandle());
149     setErrorIfExists(nativeHandle_, errorIfExists);
150     return this;
151   }
152 
153   @Override
errorIfExists()154   public boolean errorIfExists() {
155     assert(isOwningHandle());
156     return errorIfExists(nativeHandle_);
157   }
158 
159   @Override
setParanoidChecks( final boolean paranoidChecks)160   public DBOptions setParanoidChecks(
161       final boolean paranoidChecks) {
162     assert(isOwningHandle());
163     setParanoidChecks(nativeHandle_, paranoidChecks);
164     return this;
165   }
166 
167   @Override
paranoidChecks()168   public boolean paranoidChecks() {
169     assert(isOwningHandle());
170     return paranoidChecks(nativeHandle_);
171   }
172 
173   @Override
setEnv(final Env env)174   public DBOptions setEnv(final Env env) {
175     setEnv(nativeHandle_, env.nativeHandle_);
176     this.env_ = env;
177     return this;
178   }
179 
180   @Override
getEnv()181   public Env getEnv() {
182     return env_;
183   }
184 
185   @Override
setRateLimiter(final RateLimiter rateLimiter)186   public DBOptions setRateLimiter(final RateLimiter rateLimiter) {
187     assert(isOwningHandle());
188     rateLimiter_ = rateLimiter;
189     setRateLimiter(nativeHandle_, rateLimiter.nativeHandle_);
190     return this;
191   }
192 
193   @Override
setSstFileManager(final SstFileManager sstFileManager)194   public DBOptions setSstFileManager(final SstFileManager sstFileManager) {
195     assert(isOwningHandle());
196     setSstFileManager(nativeHandle_, sstFileManager.nativeHandle_);
197     return this;
198   }
199 
200   @Override
setLogger(final Logger logger)201   public DBOptions setLogger(final Logger logger) {
202     assert(isOwningHandle());
203     setLogger(nativeHandle_, logger.nativeHandle_);
204     return this;
205   }
206 
207   @Override
setInfoLogLevel( final InfoLogLevel infoLogLevel)208   public DBOptions setInfoLogLevel(
209       final InfoLogLevel infoLogLevel) {
210     assert(isOwningHandle());
211     setInfoLogLevel(nativeHandle_, infoLogLevel.getValue());
212     return this;
213   }
214 
215   @Override
infoLogLevel()216   public InfoLogLevel infoLogLevel() {
217     assert(isOwningHandle());
218     return InfoLogLevel.getInfoLogLevel(
219         infoLogLevel(nativeHandle_));
220   }
221 
222   @Override
setMaxOpenFiles( final int maxOpenFiles)223   public DBOptions setMaxOpenFiles(
224       final int maxOpenFiles) {
225     assert(isOwningHandle());
226     setMaxOpenFiles(nativeHandle_, maxOpenFiles);
227     return this;
228   }
229 
230   @Override
maxOpenFiles()231   public int maxOpenFiles() {
232     assert(isOwningHandle());
233     return maxOpenFiles(nativeHandle_);
234   }
235 
236   @Override
setMaxFileOpeningThreads(final int maxFileOpeningThreads)237   public DBOptions setMaxFileOpeningThreads(final int maxFileOpeningThreads) {
238     assert(isOwningHandle());
239     setMaxFileOpeningThreads(nativeHandle_, maxFileOpeningThreads);
240     return this;
241   }
242 
243   @Override
maxFileOpeningThreads()244   public int maxFileOpeningThreads() {
245     assert(isOwningHandle());
246     return maxFileOpeningThreads(nativeHandle_);
247   }
248 
249   @Override
setMaxTotalWalSize( final long maxTotalWalSize)250   public DBOptions setMaxTotalWalSize(
251       final long maxTotalWalSize) {
252     assert(isOwningHandle());
253     setMaxTotalWalSize(nativeHandle_, maxTotalWalSize);
254     return this;
255   }
256 
257   @Override
maxTotalWalSize()258   public long maxTotalWalSize() {
259     assert(isOwningHandle());
260     return maxTotalWalSize(nativeHandle_);
261   }
262 
263   @Override
setStatistics(final Statistics statistics)264   public DBOptions setStatistics(final Statistics statistics) {
265     assert(isOwningHandle());
266     setStatistics(nativeHandle_, statistics.nativeHandle_);
267     return this;
268   }
269 
270   @Override
statistics()271   public Statistics statistics() {
272     assert(isOwningHandle());
273     final long statisticsNativeHandle = statistics(nativeHandle_);
274     if(statisticsNativeHandle == 0) {
275       return null;
276     } else {
277       return new Statistics(statisticsNativeHandle);
278     }
279   }
280 
281   @Override
setUseFsync( final boolean useFsync)282   public DBOptions setUseFsync(
283       final boolean useFsync) {
284     assert(isOwningHandle());
285     setUseFsync(nativeHandle_, useFsync);
286     return this;
287   }
288 
289   @Override
useFsync()290   public boolean useFsync() {
291     assert(isOwningHandle());
292     return useFsync(nativeHandle_);
293   }
294 
295   @Override
setDbPaths(final Collection<DbPath> dbPaths)296   public DBOptions setDbPaths(final Collection<DbPath> dbPaths) {
297     assert(isOwningHandle());
298 
299     final int len = dbPaths.size();
300     final String[] paths = new String[len];
301     final long[] targetSizes = new long[len];
302 
303     int i = 0;
304     for(final DbPath dbPath : dbPaths) {
305       paths[i] = dbPath.path.toString();
306       targetSizes[i] = dbPath.targetSize;
307       i++;
308     }
309     setDbPaths(nativeHandle_, paths, targetSizes);
310     return this;
311   }
312 
313   @Override
dbPaths()314   public List<DbPath> dbPaths() {
315     final int len = (int)dbPathsLen(nativeHandle_);
316     if(len == 0) {
317       return Collections.emptyList();
318     } else {
319       final String[] paths = new String[len];
320       final long[] targetSizes = new long[len];
321 
322       dbPaths(nativeHandle_, paths, targetSizes);
323 
324       final List<DbPath> dbPaths = new ArrayList<>();
325       for(int i = 0; i < len; i++) {
326         dbPaths.add(new DbPath(Paths.get(paths[i]), targetSizes[i]));
327       }
328       return dbPaths;
329     }
330   }
331 
332   @Override
setDbLogDir( final String dbLogDir)333   public DBOptions setDbLogDir(
334       final String dbLogDir) {
335     assert(isOwningHandle());
336     setDbLogDir(nativeHandle_, dbLogDir);
337     return this;
338   }
339 
340   @Override
dbLogDir()341   public String dbLogDir() {
342     assert(isOwningHandle());
343     return dbLogDir(nativeHandle_);
344   }
345 
346   @Override
setWalDir( final String walDir)347   public DBOptions setWalDir(
348       final String walDir) {
349     assert(isOwningHandle());
350     setWalDir(nativeHandle_, walDir);
351     return this;
352   }
353 
354   @Override
walDir()355   public String walDir() {
356     assert(isOwningHandle());
357     return walDir(nativeHandle_);
358   }
359 
360   @Override
setDeleteObsoleteFilesPeriodMicros( final long micros)361   public DBOptions setDeleteObsoleteFilesPeriodMicros(
362       final long micros) {
363     assert(isOwningHandle());
364     setDeleteObsoleteFilesPeriodMicros(nativeHandle_, micros);
365     return this;
366   }
367 
368   @Override
deleteObsoleteFilesPeriodMicros()369   public long deleteObsoleteFilesPeriodMicros() {
370     assert(isOwningHandle());
371     return deleteObsoleteFilesPeriodMicros(nativeHandle_);
372   }
373 
374   @Override
setMaxBackgroundJobs(final int maxBackgroundJobs)375   public DBOptions setMaxBackgroundJobs(final int maxBackgroundJobs) {
376     assert(isOwningHandle());
377     setMaxBackgroundJobs(nativeHandle_, maxBackgroundJobs);
378     return this;
379   }
380 
381   @Override
maxBackgroundJobs()382   public int maxBackgroundJobs() {
383     assert(isOwningHandle());
384     return maxBackgroundJobs(nativeHandle_);
385   }
386 
387   @Override
388   @Deprecated
setBaseBackgroundCompactions( final int baseBackgroundCompactions)389   public void setBaseBackgroundCompactions(
390       final int baseBackgroundCompactions) {
391     assert(isOwningHandle());
392     setBaseBackgroundCompactions(nativeHandle_, baseBackgroundCompactions);
393   }
394 
395   @Override
baseBackgroundCompactions()396   public int baseBackgroundCompactions() {
397     assert(isOwningHandle());
398     return baseBackgroundCompactions(nativeHandle_);
399   }
400 
401   @Override
402   @Deprecated
setMaxBackgroundCompactions( final int maxBackgroundCompactions)403   public DBOptions setMaxBackgroundCompactions(
404       final int maxBackgroundCompactions) {
405     assert(isOwningHandle());
406     setMaxBackgroundCompactions(nativeHandle_, maxBackgroundCompactions);
407     return this;
408   }
409 
410   @Override
411   @Deprecated
maxBackgroundCompactions()412   public int maxBackgroundCompactions() {
413     assert(isOwningHandle());
414     return maxBackgroundCompactions(nativeHandle_);
415   }
416 
417   @Override
setMaxSubcompactions(final int maxSubcompactions)418   public DBOptions setMaxSubcompactions(final int maxSubcompactions) {
419     assert(isOwningHandle());
420     setMaxSubcompactions(nativeHandle_, maxSubcompactions);
421     return this;
422   }
423 
424   @Override
maxSubcompactions()425   public int maxSubcompactions() {
426     assert(isOwningHandle());
427     return maxSubcompactions(nativeHandle_);
428   }
429 
430   @Override
431   @Deprecated
setMaxBackgroundFlushes( final int maxBackgroundFlushes)432   public DBOptions setMaxBackgroundFlushes(
433       final int maxBackgroundFlushes) {
434     assert(isOwningHandle());
435     setMaxBackgroundFlushes(nativeHandle_, maxBackgroundFlushes);
436     return this;
437   }
438 
439   @Override
440   @Deprecated
maxBackgroundFlushes()441   public int maxBackgroundFlushes() {
442     assert(isOwningHandle());
443     return maxBackgroundFlushes(nativeHandle_);
444   }
445 
446   @Override
setMaxLogFileSize(final long maxLogFileSize)447   public DBOptions setMaxLogFileSize(final long maxLogFileSize) {
448     assert(isOwningHandle());
449     setMaxLogFileSize(nativeHandle_, maxLogFileSize);
450     return this;
451   }
452 
453   @Override
maxLogFileSize()454   public long maxLogFileSize() {
455     assert(isOwningHandle());
456     return maxLogFileSize(nativeHandle_);
457   }
458 
459   @Override
setLogFileTimeToRoll( final long logFileTimeToRoll)460   public DBOptions setLogFileTimeToRoll(
461       final long logFileTimeToRoll) {
462     assert(isOwningHandle());
463     setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
464     return this;
465   }
466 
467   @Override
logFileTimeToRoll()468   public long logFileTimeToRoll() {
469     assert(isOwningHandle());
470     return logFileTimeToRoll(nativeHandle_);
471   }
472 
473   @Override
setKeepLogFileNum( final long keepLogFileNum)474   public DBOptions setKeepLogFileNum(
475       final long keepLogFileNum) {
476     assert(isOwningHandle());
477     setKeepLogFileNum(nativeHandle_, keepLogFileNum);
478     return this;
479   }
480 
481   @Override
keepLogFileNum()482   public long keepLogFileNum() {
483     assert(isOwningHandle());
484     return keepLogFileNum(nativeHandle_);
485   }
486 
487   @Override
setRecycleLogFileNum(final long recycleLogFileNum)488   public DBOptions setRecycleLogFileNum(final long recycleLogFileNum) {
489     assert(isOwningHandle());
490     setRecycleLogFileNum(nativeHandle_, recycleLogFileNum);
491     return this;
492   }
493 
494   @Override
recycleLogFileNum()495   public long recycleLogFileNum() {
496     assert(isOwningHandle());
497     return recycleLogFileNum(nativeHandle_);
498   }
499 
500   @Override
setMaxManifestFileSize( final long maxManifestFileSize)501   public DBOptions setMaxManifestFileSize(
502       final long maxManifestFileSize) {
503     assert(isOwningHandle());
504     setMaxManifestFileSize(nativeHandle_, maxManifestFileSize);
505     return this;
506   }
507 
508   @Override
maxManifestFileSize()509   public long maxManifestFileSize() {
510     assert(isOwningHandle());
511     return maxManifestFileSize(nativeHandle_);
512   }
513 
514   @Override
setTableCacheNumshardbits( final int tableCacheNumshardbits)515   public DBOptions setTableCacheNumshardbits(
516       final int tableCacheNumshardbits) {
517     assert(isOwningHandle());
518     setTableCacheNumshardbits(nativeHandle_, tableCacheNumshardbits);
519     return this;
520   }
521 
522   @Override
tableCacheNumshardbits()523   public int tableCacheNumshardbits() {
524     assert(isOwningHandle());
525     return tableCacheNumshardbits(nativeHandle_);
526   }
527 
528   @Override
setWalTtlSeconds( final long walTtlSeconds)529   public DBOptions setWalTtlSeconds(
530       final long walTtlSeconds) {
531     assert(isOwningHandle());
532     setWalTtlSeconds(nativeHandle_, walTtlSeconds);
533     return this;
534   }
535 
536   @Override
walTtlSeconds()537   public long walTtlSeconds() {
538     assert(isOwningHandle());
539     return walTtlSeconds(nativeHandle_);
540   }
541 
542   @Override
setWalSizeLimitMB( final long sizeLimitMB)543   public DBOptions setWalSizeLimitMB(
544       final long sizeLimitMB) {
545     assert(isOwningHandle());
546     setWalSizeLimitMB(nativeHandle_, sizeLimitMB);
547     return this;
548   }
549 
550   @Override
walSizeLimitMB()551   public long walSizeLimitMB() {
552     assert(isOwningHandle());
553     return walSizeLimitMB(nativeHandle_);
554   }
555 
556   @Override
setManifestPreallocationSize( final long size)557   public DBOptions setManifestPreallocationSize(
558       final long size) {
559     assert(isOwningHandle());
560     setManifestPreallocationSize(nativeHandle_, size);
561     return this;
562   }
563 
564   @Override
manifestPreallocationSize()565   public long manifestPreallocationSize() {
566     assert(isOwningHandle());
567     return manifestPreallocationSize(nativeHandle_);
568   }
569 
570   @Override
setAllowMmapReads( final boolean allowMmapReads)571   public DBOptions setAllowMmapReads(
572       final boolean allowMmapReads) {
573     assert(isOwningHandle());
574     setAllowMmapReads(nativeHandle_, allowMmapReads);
575     return this;
576   }
577 
578   @Override
allowMmapReads()579   public boolean allowMmapReads() {
580     assert(isOwningHandle());
581     return allowMmapReads(nativeHandle_);
582   }
583 
584   @Override
setAllowMmapWrites( final boolean allowMmapWrites)585   public DBOptions setAllowMmapWrites(
586       final boolean allowMmapWrites) {
587     assert(isOwningHandle());
588     setAllowMmapWrites(nativeHandle_, allowMmapWrites);
589     return this;
590   }
591 
592   @Override
allowMmapWrites()593   public boolean allowMmapWrites() {
594     assert(isOwningHandle());
595     return allowMmapWrites(nativeHandle_);
596   }
597 
598   @Override
setUseDirectReads( final boolean useDirectReads)599   public DBOptions setUseDirectReads(
600       final boolean useDirectReads) {
601     assert(isOwningHandle());
602     setUseDirectReads(nativeHandle_, useDirectReads);
603     return this;
604   }
605 
606   @Override
useDirectReads()607   public boolean useDirectReads() {
608     assert(isOwningHandle());
609     return useDirectReads(nativeHandle_);
610   }
611 
612   @Override
setUseDirectIoForFlushAndCompaction( final boolean useDirectIoForFlushAndCompaction)613   public DBOptions setUseDirectIoForFlushAndCompaction(
614       final boolean useDirectIoForFlushAndCompaction) {
615     assert(isOwningHandle());
616     setUseDirectIoForFlushAndCompaction(nativeHandle_,
617         useDirectIoForFlushAndCompaction);
618     return this;
619   }
620 
621   @Override
useDirectIoForFlushAndCompaction()622   public boolean useDirectIoForFlushAndCompaction() {
623     assert(isOwningHandle());
624     return useDirectIoForFlushAndCompaction(nativeHandle_);
625   }
626 
627   @Override
setAllowFAllocate(final boolean allowFAllocate)628   public DBOptions setAllowFAllocate(final boolean allowFAllocate) {
629     assert(isOwningHandle());
630     setAllowFAllocate(nativeHandle_, allowFAllocate);
631     return this;
632   }
633 
634   @Override
allowFAllocate()635   public boolean allowFAllocate() {
636     assert(isOwningHandle());
637     return allowFAllocate(nativeHandle_);
638   }
639 
640   @Override
setIsFdCloseOnExec( final boolean isFdCloseOnExec)641   public DBOptions setIsFdCloseOnExec(
642       final boolean isFdCloseOnExec) {
643     assert(isOwningHandle());
644     setIsFdCloseOnExec(nativeHandle_, isFdCloseOnExec);
645     return this;
646   }
647 
648   @Override
isFdCloseOnExec()649   public boolean isFdCloseOnExec() {
650     assert(isOwningHandle());
651     return isFdCloseOnExec(nativeHandle_);
652   }
653 
654   @Override
setStatsDumpPeriodSec( final int statsDumpPeriodSec)655   public DBOptions setStatsDumpPeriodSec(
656       final int statsDumpPeriodSec) {
657     assert(isOwningHandle());
658     setStatsDumpPeriodSec(nativeHandle_, statsDumpPeriodSec);
659     return this;
660   }
661 
662   @Override
statsDumpPeriodSec()663   public int statsDumpPeriodSec() {
664     assert(isOwningHandle());
665     return statsDumpPeriodSec(nativeHandle_);
666   }
667 
668   @Override
setStatsPersistPeriodSec( final int statsPersistPeriodSec)669   public DBOptions setStatsPersistPeriodSec(
670       final int statsPersistPeriodSec) {
671     assert(isOwningHandle());
672     setStatsPersistPeriodSec(nativeHandle_, statsPersistPeriodSec);
673     return this;
674   }
675 
676   @Override
statsPersistPeriodSec()677   public int statsPersistPeriodSec() {
678     assert(isOwningHandle());
679     return statsPersistPeriodSec(nativeHandle_);
680   }
681 
682   @Override
setStatsHistoryBufferSize( final long statsHistoryBufferSize)683   public DBOptions setStatsHistoryBufferSize(
684       final long statsHistoryBufferSize) {
685     assert(isOwningHandle());
686     setStatsHistoryBufferSize(nativeHandle_, statsHistoryBufferSize);
687     return this;
688   }
689 
690   @Override
statsHistoryBufferSize()691   public long statsHistoryBufferSize() {
692     assert(isOwningHandle());
693     return statsHistoryBufferSize(nativeHandle_);
694   }
695 
696   @Override
setAdviseRandomOnOpen( final boolean adviseRandomOnOpen)697   public DBOptions setAdviseRandomOnOpen(
698       final boolean adviseRandomOnOpen) {
699     assert(isOwningHandle());
700     setAdviseRandomOnOpen(nativeHandle_, adviseRandomOnOpen);
701     return this;
702   }
703 
704   @Override
adviseRandomOnOpen()705   public boolean adviseRandomOnOpen() {
706     return adviseRandomOnOpen(nativeHandle_);
707   }
708 
709   @Override
setDbWriteBufferSize(final long dbWriteBufferSize)710   public DBOptions setDbWriteBufferSize(final long dbWriteBufferSize) {
711     assert(isOwningHandle());
712     setDbWriteBufferSize(nativeHandle_, dbWriteBufferSize);
713     return this;
714   }
715 
716   @Override
setWriteBufferManager(final WriteBufferManager writeBufferManager)717   public DBOptions setWriteBufferManager(final WriteBufferManager writeBufferManager) {
718     assert(isOwningHandle());
719     setWriteBufferManager(nativeHandle_, writeBufferManager.nativeHandle_);
720     this.writeBufferManager_ = writeBufferManager;
721     return this;
722   }
723 
724   @Override
writeBufferManager()725   public WriteBufferManager writeBufferManager() {
726     assert(isOwningHandle());
727     return this.writeBufferManager_;
728   }
729 
730   @Override
dbWriteBufferSize()731   public long dbWriteBufferSize() {
732     assert(isOwningHandle());
733     return dbWriteBufferSize(nativeHandle_);
734   }
735 
736   @Override
setAccessHintOnCompactionStart(final AccessHint accessHint)737   public DBOptions setAccessHintOnCompactionStart(final AccessHint accessHint) {
738     assert(isOwningHandle());
739     setAccessHintOnCompactionStart(nativeHandle_, accessHint.getValue());
740     return this;
741   }
742 
743   @Override
accessHintOnCompactionStart()744   public AccessHint accessHintOnCompactionStart() {
745     assert(isOwningHandle());
746     return AccessHint.getAccessHint(accessHintOnCompactionStart(nativeHandle_));
747   }
748 
749   @Override
setNewTableReaderForCompactionInputs( final boolean newTableReaderForCompactionInputs)750   public DBOptions setNewTableReaderForCompactionInputs(
751       final boolean newTableReaderForCompactionInputs) {
752     assert(isOwningHandle());
753     setNewTableReaderForCompactionInputs(nativeHandle_,
754         newTableReaderForCompactionInputs);
755     return this;
756   }
757 
758   @Override
newTableReaderForCompactionInputs()759   public boolean newTableReaderForCompactionInputs() {
760     assert(isOwningHandle());
761     return newTableReaderForCompactionInputs(nativeHandle_);
762   }
763 
764   @Override
setCompactionReadaheadSize(final long compactionReadaheadSize)765   public DBOptions setCompactionReadaheadSize(final long compactionReadaheadSize) {
766     assert(isOwningHandle());
767     setCompactionReadaheadSize(nativeHandle_, compactionReadaheadSize);
768     return this;
769   }
770 
771   @Override
compactionReadaheadSize()772   public long compactionReadaheadSize() {
773     assert(isOwningHandle());
774     return compactionReadaheadSize(nativeHandle_);
775   }
776 
777   @Override
setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize)778   public DBOptions setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize) {
779     assert(isOwningHandle());
780     setRandomAccessMaxBufferSize(nativeHandle_, randomAccessMaxBufferSize);
781     return this;
782   }
783 
784   @Override
randomAccessMaxBufferSize()785   public long randomAccessMaxBufferSize() {
786     assert(isOwningHandle());
787     return randomAccessMaxBufferSize(nativeHandle_);
788   }
789 
790   @Override
setWritableFileMaxBufferSize(final long writableFileMaxBufferSize)791   public DBOptions setWritableFileMaxBufferSize(final long writableFileMaxBufferSize) {
792     assert(isOwningHandle());
793     setWritableFileMaxBufferSize(nativeHandle_, writableFileMaxBufferSize);
794     return this;
795   }
796 
797   @Override
writableFileMaxBufferSize()798   public long writableFileMaxBufferSize() {
799     assert(isOwningHandle());
800     return writableFileMaxBufferSize(nativeHandle_);
801   }
802 
803   @Override
setUseAdaptiveMutex( final boolean useAdaptiveMutex)804   public DBOptions setUseAdaptiveMutex(
805       final boolean useAdaptiveMutex) {
806     assert(isOwningHandle());
807     setUseAdaptiveMutex(nativeHandle_, useAdaptiveMutex);
808     return this;
809   }
810 
811   @Override
useAdaptiveMutex()812   public boolean useAdaptiveMutex() {
813     assert(isOwningHandle());
814     return useAdaptiveMutex(nativeHandle_);
815   }
816 
817   @Override
setBytesPerSync( final long bytesPerSync)818   public DBOptions setBytesPerSync(
819       final long bytesPerSync) {
820     assert(isOwningHandle());
821     setBytesPerSync(nativeHandle_, bytesPerSync);
822     return this;
823   }
824 
825   @Override
bytesPerSync()826   public long bytesPerSync() {
827     return bytesPerSync(nativeHandle_);
828   }
829 
830   @Override
setWalBytesPerSync(final long walBytesPerSync)831   public DBOptions setWalBytesPerSync(final long walBytesPerSync) {
832     assert(isOwningHandle());
833     setWalBytesPerSync(nativeHandle_, walBytesPerSync);
834     return this;
835   }
836 
837   @Override
walBytesPerSync()838   public long walBytesPerSync() {
839     assert(isOwningHandle());
840     return walBytesPerSync(nativeHandle_);
841   }
842 
843   @Override
setStrictBytesPerSync(final boolean strictBytesPerSync)844   public DBOptions setStrictBytesPerSync(final boolean strictBytesPerSync) {
845     assert(isOwningHandle());
846     setStrictBytesPerSync(nativeHandle_, strictBytesPerSync);
847     return this;
848   }
849 
850   @Override
strictBytesPerSync()851   public boolean strictBytesPerSync() {
852     assert(isOwningHandle());
853     return strictBytesPerSync(nativeHandle_);
854   }
855 
856   //TODO(AR) NOW
857 //  @Override
858 //  public DBOptions setListeners(final List<EventListener> listeners) {
859 //    assert(isOwningHandle());
860 //    final long[] eventListenerHandlers = new long[listeners.size()];
861 //    for (int i = 0; i < eventListenerHandlers.length; i++) {
862 //      eventListenerHandlers[i] = listeners.get(i).nativeHandle_;
863 //    }
864 //    setEventListeners(nativeHandle_, eventListenerHandlers);
865 //    return this;
866 //  }
867 //
868 //  @Override
869 //  public Collection<EventListener> listeners() {
870 //    assert(isOwningHandle());
871 //    final long[] eventListenerHandlers = listeners(nativeHandle_);
872 //    if (eventListenerHandlers == null || eventListenerHandlers.length == 0) {
873 //      return Collections.emptyList();
874 //    }
875 //
876 //    final List<EventListener> eventListeners = new ArrayList<>();
877 //    for (final long eventListenerHandle : eventListenerHandlers) {
878 //      eventListeners.add(new EventListener(eventListenerHandle)); //TODO(AR) check ownership is set to false!
879 //    }
880 //    return eventListeners;
881 //  }
882 
883   @Override
setEnableThreadTracking(final boolean enableThreadTracking)884   public DBOptions setEnableThreadTracking(final boolean enableThreadTracking) {
885     assert(isOwningHandle());
886     setEnableThreadTracking(nativeHandle_, enableThreadTracking);
887     return this;
888   }
889 
890   @Override
enableThreadTracking()891   public boolean enableThreadTracking() {
892     assert(isOwningHandle());
893     return enableThreadTracking(nativeHandle_);
894   }
895 
896   @Override
setDelayedWriteRate(final long delayedWriteRate)897   public DBOptions setDelayedWriteRate(final long delayedWriteRate) {
898     assert(isOwningHandle());
899     setDelayedWriteRate(nativeHandle_, delayedWriteRate);
900     return this;
901   }
902 
903   @Override
delayedWriteRate()904   public long delayedWriteRate(){
905     return delayedWriteRate(nativeHandle_);
906   }
907 
908   @Override
setEnablePipelinedWrite(final boolean enablePipelinedWrite)909   public DBOptions setEnablePipelinedWrite(final boolean enablePipelinedWrite) {
910     assert(isOwningHandle());
911     setEnablePipelinedWrite(nativeHandle_, enablePipelinedWrite);
912     return this;
913   }
914 
915   @Override
enablePipelinedWrite()916   public boolean enablePipelinedWrite() {
917     assert(isOwningHandle());
918     return enablePipelinedWrite(nativeHandle_);
919   }
920 
921   @Override
setUnorderedWrite(final boolean unorderedWrite)922   public DBOptions setUnorderedWrite(final boolean unorderedWrite) {
923     setUnorderedWrite(nativeHandle_, unorderedWrite);
924     return this;
925   }
926 
927   @Override
unorderedWrite()928   public boolean unorderedWrite() {
929     return unorderedWrite(nativeHandle_);
930   }
931 
932 
933   @Override
setAllowConcurrentMemtableWrite( final boolean allowConcurrentMemtableWrite)934   public DBOptions setAllowConcurrentMemtableWrite(
935       final boolean allowConcurrentMemtableWrite) {
936     setAllowConcurrentMemtableWrite(nativeHandle_,
937         allowConcurrentMemtableWrite);
938     return this;
939   }
940 
941   @Override
allowConcurrentMemtableWrite()942   public boolean allowConcurrentMemtableWrite() {
943     return allowConcurrentMemtableWrite(nativeHandle_);
944   }
945 
946   @Override
setEnableWriteThreadAdaptiveYield( final boolean enableWriteThreadAdaptiveYield)947   public DBOptions setEnableWriteThreadAdaptiveYield(
948       final boolean enableWriteThreadAdaptiveYield) {
949     setEnableWriteThreadAdaptiveYield(nativeHandle_,
950         enableWriteThreadAdaptiveYield);
951     return this;
952   }
953 
954   @Override
enableWriteThreadAdaptiveYield()955   public boolean enableWriteThreadAdaptiveYield() {
956     return enableWriteThreadAdaptiveYield(nativeHandle_);
957   }
958 
959   @Override
setWriteThreadMaxYieldUsec(final long writeThreadMaxYieldUsec)960   public DBOptions setWriteThreadMaxYieldUsec(final long writeThreadMaxYieldUsec) {
961     setWriteThreadMaxYieldUsec(nativeHandle_, writeThreadMaxYieldUsec);
962     return this;
963   }
964 
965   @Override
writeThreadMaxYieldUsec()966   public long writeThreadMaxYieldUsec() {
967     return writeThreadMaxYieldUsec(nativeHandle_);
968   }
969 
970   @Override
setWriteThreadSlowYieldUsec(final long writeThreadSlowYieldUsec)971   public DBOptions setWriteThreadSlowYieldUsec(final long writeThreadSlowYieldUsec) {
972     setWriteThreadSlowYieldUsec(nativeHandle_, writeThreadSlowYieldUsec);
973     return this;
974   }
975 
976   @Override
writeThreadSlowYieldUsec()977   public long writeThreadSlowYieldUsec() {
978     return writeThreadSlowYieldUsec(nativeHandle_);
979   }
980 
981   @Override
setSkipStatsUpdateOnDbOpen(final boolean skipStatsUpdateOnDbOpen)982   public DBOptions setSkipStatsUpdateOnDbOpen(final boolean skipStatsUpdateOnDbOpen) {
983     assert(isOwningHandle());
984     setSkipStatsUpdateOnDbOpen(nativeHandle_, skipStatsUpdateOnDbOpen);
985     return this;
986   }
987 
988   @Override
skipStatsUpdateOnDbOpen()989   public boolean skipStatsUpdateOnDbOpen() {
990     assert(isOwningHandle());
991     return skipStatsUpdateOnDbOpen(nativeHandle_);
992   }
993 
994   @Override
setWalRecoveryMode(final WALRecoveryMode walRecoveryMode)995   public DBOptions setWalRecoveryMode(final WALRecoveryMode walRecoveryMode) {
996     assert(isOwningHandle());
997     setWalRecoveryMode(nativeHandle_, walRecoveryMode.getValue());
998     return this;
999   }
1000 
1001   @Override
walRecoveryMode()1002   public WALRecoveryMode walRecoveryMode() {
1003     assert(isOwningHandle());
1004     return WALRecoveryMode.getWALRecoveryMode(walRecoveryMode(nativeHandle_));
1005   }
1006 
1007   @Override
setAllow2pc(final boolean allow2pc)1008   public DBOptions setAllow2pc(final boolean allow2pc) {
1009     assert(isOwningHandle());
1010     setAllow2pc(nativeHandle_, allow2pc);
1011     return this;
1012   }
1013 
1014   @Override
allow2pc()1015   public boolean allow2pc() {
1016     assert(isOwningHandle());
1017     return allow2pc(nativeHandle_);
1018   }
1019 
1020   @Override
setRowCache(final Cache rowCache)1021   public DBOptions setRowCache(final Cache rowCache) {
1022     assert(isOwningHandle());
1023     setRowCache(nativeHandle_, rowCache.nativeHandle_);
1024     this.rowCache_ = rowCache;
1025     return this;
1026   }
1027 
1028   @Override
rowCache()1029   public Cache rowCache() {
1030     assert(isOwningHandle());
1031     return this.rowCache_;
1032   }
1033 
1034   @Override
setWalFilter(final AbstractWalFilter walFilter)1035   public DBOptions setWalFilter(final AbstractWalFilter walFilter) {
1036     assert(isOwningHandle());
1037     setWalFilter(nativeHandle_, walFilter.nativeHandle_);
1038     this.walFilter_ = walFilter;
1039     return this;
1040   }
1041 
1042   @Override
walFilter()1043   public WalFilter walFilter() {
1044     assert(isOwningHandle());
1045     return this.walFilter_;
1046   }
1047 
1048   @Override
setFailIfOptionsFileError(final boolean failIfOptionsFileError)1049   public DBOptions setFailIfOptionsFileError(final boolean failIfOptionsFileError) {
1050     assert(isOwningHandle());
1051     setFailIfOptionsFileError(nativeHandle_, failIfOptionsFileError);
1052     return this;
1053   }
1054 
1055   @Override
failIfOptionsFileError()1056   public boolean failIfOptionsFileError() {
1057     assert(isOwningHandle());
1058     return failIfOptionsFileError(nativeHandle_);
1059   }
1060 
1061   @Override
setDumpMallocStats(final boolean dumpMallocStats)1062   public DBOptions setDumpMallocStats(final boolean dumpMallocStats) {
1063     assert(isOwningHandle());
1064     setDumpMallocStats(nativeHandle_, dumpMallocStats);
1065     return this;
1066   }
1067 
1068   @Override
dumpMallocStats()1069   public boolean dumpMallocStats() {
1070     assert(isOwningHandle());
1071     return dumpMallocStats(nativeHandle_);
1072   }
1073 
1074   @Override
setAvoidFlushDuringRecovery(final boolean avoidFlushDuringRecovery)1075   public DBOptions setAvoidFlushDuringRecovery(final boolean avoidFlushDuringRecovery) {
1076     assert(isOwningHandle());
1077     setAvoidFlushDuringRecovery(nativeHandle_, avoidFlushDuringRecovery);
1078     return this;
1079   }
1080 
1081   @Override
avoidFlushDuringRecovery()1082   public boolean avoidFlushDuringRecovery() {
1083     assert(isOwningHandle());
1084     return avoidFlushDuringRecovery(nativeHandle_);
1085   }
1086 
1087   @Override
setAvoidFlushDuringShutdown(final boolean avoidFlushDuringShutdown)1088   public DBOptions setAvoidFlushDuringShutdown(final boolean avoidFlushDuringShutdown) {
1089     assert(isOwningHandle());
1090     setAvoidFlushDuringShutdown(nativeHandle_, avoidFlushDuringShutdown);
1091     return this;
1092   }
1093 
1094   @Override
avoidFlushDuringShutdown()1095   public boolean avoidFlushDuringShutdown() {
1096     assert(isOwningHandle());
1097     return avoidFlushDuringShutdown(nativeHandle_);
1098   }
1099 
1100   @Override
setAllowIngestBehind(final boolean allowIngestBehind)1101   public DBOptions setAllowIngestBehind(final boolean allowIngestBehind) {
1102     assert(isOwningHandle());
1103     setAllowIngestBehind(nativeHandle_, allowIngestBehind);
1104     return this;
1105   }
1106 
1107   @Override
allowIngestBehind()1108   public boolean allowIngestBehind() {
1109     assert(isOwningHandle());
1110     return allowIngestBehind(nativeHandle_);
1111   }
1112 
1113   @Override
setPreserveDeletes(final boolean preserveDeletes)1114   public DBOptions setPreserveDeletes(final boolean preserveDeletes) {
1115     assert(isOwningHandle());
1116     setPreserveDeletes(nativeHandle_, preserveDeletes);
1117     return this;
1118   }
1119 
1120   @Override
preserveDeletes()1121   public boolean preserveDeletes() {
1122     assert(isOwningHandle());
1123     return preserveDeletes(nativeHandle_);
1124   }
1125 
1126   @Override
setTwoWriteQueues(final boolean twoWriteQueues)1127   public DBOptions setTwoWriteQueues(final boolean twoWriteQueues) {
1128     assert(isOwningHandle());
1129     setTwoWriteQueues(nativeHandle_, twoWriteQueues);
1130     return this;
1131   }
1132 
1133   @Override
twoWriteQueues()1134   public boolean twoWriteQueues() {
1135     assert(isOwningHandle());
1136     return twoWriteQueues(nativeHandle_);
1137   }
1138 
1139   @Override
setManualWalFlush(final boolean manualWalFlush)1140   public DBOptions setManualWalFlush(final boolean manualWalFlush) {
1141     assert(isOwningHandle());
1142     setManualWalFlush(nativeHandle_, manualWalFlush);
1143     return this;
1144   }
1145 
1146   @Override
manualWalFlush()1147   public boolean manualWalFlush() {
1148     assert(isOwningHandle());
1149     return manualWalFlush(nativeHandle_);
1150   }
1151 
1152   @Override
setAtomicFlush(final boolean atomicFlush)1153   public DBOptions setAtomicFlush(final boolean atomicFlush) {
1154     setAtomicFlush(nativeHandle_, atomicFlush);
1155     return this;
1156   }
1157 
1158   @Override
atomicFlush()1159   public boolean atomicFlush() {
1160     return atomicFlush(nativeHandle_);
1161   }
1162 
1163   static final int DEFAULT_NUM_SHARD_BITS = -1;
1164 
1165 
1166 
1167 
1168   /**
1169    * <p>Private constructor to be used by
1170    * {@link #getDBOptionsFromProps(java.util.Properties)}</p>
1171    *
1172    * @param nativeHandle native handle to DBOptions instance.
1173    */
DBOptions(final long nativeHandle)1174   private DBOptions(final long nativeHandle) {
1175     super(nativeHandle);
1176   }
1177 
getDBOptionsFromProps( String optString)1178   private static native long getDBOptionsFromProps(
1179       String optString);
1180 
newDBOptions()1181   private static native long newDBOptions();
copyDBOptions(final long handle)1182   private static native long copyDBOptions(final long handle);
newDBOptionsFromOptions(final long optionsHandle)1183   private static native long newDBOptionsFromOptions(final long optionsHandle);
disposeInternal(final long handle)1184   @Override protected final native void disposeInternal(final long handle);
1185 
optimizeForSmallDb(final long handle)1186   private native void optimizeForSmallDb(final long handle);
setIncreaseParallelism(long handle, int totalThreads)1187   private native void setIncreaseParallelism(long handle, int totalThreads);
setCreateIfMissing(long handle, boolean flag)1188   private native void setCreateIfMissing(long handle, boolean flag);
createIfMissing(long handle)1189   private native boolean createIfMissing(long handle);
setCreateMissingColumnFamilies( long handle, boolean flag)1190   private native void setCreateMissingColumnFamilies(
1191       long handle, boolean flag);
createMissingColumnFamilies(long handle)1192   private native boolean createMissingColumnFamilies(long handle);
setEnv(long handle, long envHandle)1193   private native void setEnv(long handle, long envHandle);
setErrorIfExists(long handle, boolean errorIfExists)1194   private native void setErrorIfExists(long handle, boolean errorIfExists);
errorIfExists(long handle)1195   private native boolean errorIfExists(long handle);
setParanoidChecks( long handle, boolean paranoidChecks)1196   private native void setParanoidChecks(
1197       long handle, boolean paranoidChecks);
paranoidChecks(long handle)1198   private native boolean paranoidChecks(long handle);
setRateLimiter(long handle, long rateLimiterHandle)1199   private native void setRateLimiter(long handle,
1200       long rateLimiterHandle);
setSstFileManager(final long handle, final long sstFileManagerHandle)1201   private native void setSstFileManager(final long handle,
1202       final long sstFileManagerHandle);
setLogger(long handle, long loggerHandle)1203   private native void setLogger(long handle,
1204       long loggerHandle);
setInfoLogLevel(long handle, byte logLevel)1205   private native void setInfoLogLevel(long handle, byte logLevel);
infoLogLevel(long handle)1206   private native byte infoLogLevel(long handle);
setMaxOpenFiles(long handle, int maxOpenFiles)1207   private native void setMaxOpenFiles(long handle, int maxOpenFiles);
maxOpenFiles(long handle)1208   private native int maxOpenFiles(long handle);
setMaxFileOpeningThreads(final long handle, final int maxFileOpeningThreads)1209   private native void setMaxFileOpeningThreads(final long handle,
1210       final int maxFileOpeningThreads);
maxFileOpeningThreads(final long handle)1211   private native int maxFileOpeningThreads(final long handle);
setMaxTotalWalSize(long handle, long maxTotalWalSize)1212   private native void setMaxTotalWalSize(long handle,
1213       long maxTotalWalSize);
maxTotalWalSize(long handle)1214   private native long maxTotalWalSize(long handle);
setStatistics(final long handle, final long statisticsHandle)1215   private native void setStatistics(final long handle, final long statisticsHandle);
statistics(final long handle)1216   private native long statistics(final long handle);
useFsync(long handle)1217   private native boolean useFsync(long handle);
setUseFsync(long handle, boolean useFsync)1218   private native void setUseFsync(long handle, boolean useFsync);
setDbPaths(final long handle, final String[] paths, final long[] targetSizes)1219   private native void setDbPaths(final long handle, final String[] paths,
1220       final long[] targetSizes);
dbPathsLen(final long handle)1221   private native long dbPathsLen(final long handle);
dbPaths(final long handle, final String[] paths, final long[] targetSizes)1222   private native void dbPaths(final long handle, final String[] paths,
1223                                  final long[] targetSizes);
setDbLogDir(long handle, String dbLogDir)1224   private native void setDbLogDir(long handle, String dbLogDir);
dbLogDir(long handle)1225   private native String dbLogDir(long handle);
setWalDir(long handle, String walDir)1226   private native void setWalDir(long handle, String walDir);
walDir(long handle)1227   private native String walDir(long handle);
setDeleteObsoleteFilesPeriodMicros( long handle, long micros)1228   private native void setDeleteObsoleteFilesPeriodMicros(
1229       long handle, long micros);
deleteObsoleteFilesPeriodMicros(long handle)1230   private native long deleteObsoleteFilesPeriodMicros(long handle);
setBaseBackgroundCompactions(long handle, int baseBackgroundCompactions)1231   private native void setBaseBackgroundCompactions(long handle,
1232       int baseBackgroundCompactions);
baseBackgroundCompactions(long handle)1233   private native int baseBackgroundCompactions(long handle);
setMaxBackgroundCompactions( long handle, int maxBackgroundCompactions)1234   private native void setMaxBackgroundCompactions(
1235       long handle, int maxBackgroundCompactions);
maxBackgroundCompactions(long handle)1236   private native int maxBackgroundCompactions(long handle);
setMaxSubcompactions(long handle, int maxSubcompactions)1237   private native void setMaxSubcompactions(long handle, int maxSubcompactions);
maxSubcompactions(long handle)1238   private native int maxSubcompactions(long handle);
setMaxBackgroundFlushes( long handle, int maxBackgroundFlushes)1239   private native void setMaxBackgroundFlushes(
1240       long handle, int maxBackgroundFlushes);
maxBackgroundFlushes(long handle)1241   private native int maxBackgroundFlushes(long handle);
setMaxBackgroundJobs(long handle, int maxBackgroundJobs)1242   private native void setMaxBackgroundJobs(long handle, int maxBackgroundJobs);
maxBackgroundJobs(long handle)1243   private native int maxBackgroundJobs(long handle);
setMaxLogFileSize(long handle, long maxLogFileSize)1244   private native void setMaxLogFileSize(long handle, long maxLogFileSize)
1245       throws IllegalArgumentException;
maxLogFileSize(long handle)1246   private native long maxLogFileSize(long handle);
setLogFileTimeToRoll( long handle, long logFileTimeToRoll)1247   private native void setLogFileTimeToRoll(
1248       long handle, long logFileTimeToRoll) throws IllegalArgumentException;
logFileTimeToRoll(long handle)1249   private native long logFileTimeToRoll(long handle);
setKeepLogFileNum(long handle, long keepLogFileNum)1250   private native void setKeepLogFileNum(long handle, long keepLogFileNum)
1251       throws IllegalArgumentException;
keepLogFileNum(long handle)1252   private native long keepLogFileNum(long handle);
setRecycleLogFileNum(long handle, long recycleLogFileNum)1253   private native void setRecycleLogFileNum(long handle, long recycleLogFileNum);
recycleLogFileNum(long handle)1254   private native long recycleLogFileNum(long handle);
setMaxManifestFileSize( long handle, long maxManifestFileSize)1255   private native void setMaxManifestFileSize(
1256       long handle, long maxManifestFileSize);
maxManifestFileSize(long handle)1257   private native long maxManifestFileSize(long handle);
setTableCacheNumshardbits( long handle, int tableCacheNumshardbits)1258   private native void setTableCacheNumshardbits(
1259       long handle, int tableCacheNumshardbits);
tableCacheNumshardbits(long handle)1260   private native int tableCacheNumshardbits(long handle);
setWalTtlSeconds(long handle, long walTtlSeconds)1261   private native void setWalTtlSeconds(long handle, long walTtlSeconds);
walTtlSeconds(long handle)1262   private native long walTtlSeconds(long handle);
setWalSizeLimitMB(long handle, long sizeLimitMB)1263   private native void setWalSizeLimitMB(long handle, long sizeLimitMB);
walSizeLimitMB(long handle)1264   private native long walSizeLimitMB(long handle);
setManifestPreallocationSize( long handle, long size)1265   private native void setManifestPreallocationSize(
1266       long handle, long size) throws IllegalArgumentException;
manifestPreallocationSize(long handle)1267   private native long manifestPreallocationSize(long handle);
setUseDirectReads(long handle, boolean useDirectReads)1268   private native void setUseDirectReads(long handle, boolean useDirectReads);
useDirectReads(long handle)1269   private native boolean useDirectReads(long handle);
setUseDirectIoForFlushAndCompaction( long handle, boolean useDirectIoForFlushAndCompaction)1270   private native void setUseDirectIoForFlushAndCompaction(
1271       long handle, boolean useDirectIoForFlushAndCompaction);
useDirectIoForFlushAndCompaction(long handle)1272   private native boolean useDirectIoForFlushAndCompaction(long handle);
setAllowFAllocate(final long handle, final boolean allowFAllocate)1273   private native void setAllowFAllocate(final long handle,
1274       final boolean allowFAllocate);
allowFAllocate(final long handle)1275   private native boolean allowFAllocate(final long handle);
setAllowMmapReads( long handle, boolean allowMmapReads)1276   private native void setAllowMmapReads(
1277       long handle, boolean allowMmapReads);
allowMmapReads(long handle)1278   private native boolean allowMmapReads(long handle);
setAllowMmapWrites( long handle, boolean allowMmapWrites)1279   private native void setAllowMmapWrites(
1280       long handle, boolean allowMmapWrites);
allowMmapWrites(long handle)1281   private native boolean allowMmapWrites(long handle);
setIsFdCloseOnExec( long handle, boolean isFdCloseOnExec)1282   private native void setIsFdCloseOnExec(
1283       long handle, boolean isFdCloseOnExec);
isFdCloseOnExec(long handle)1284   private native boolean isFdCloseOnExec(long handle);
setStatsDumpPeriodSec( long handle, int statsDumpPeriodSec)1285   private native void setStatsDumpPeriodSec(
1286       long handle, int statsDumpPeriodSec);
statsDumpPeriodSec(long handle)1287   private native int statsDumpPeriodSec(long handle);
setStatsPersistPeriodSec( final long handle, final int statsPersistPeriodSec)1288   private native void setStatsPersistPeriodSec(
1289       final long handle, final int statsPersistPeriodSec);
statsPersistPeriodSec( final long handle)1290   private native int statsPersistPeriodSec(
1291       final long handle);
setStatsHistoryBufferSize( final long handle, final long statsHistoryBufferSize)1292   private native void setStatsHistoryBufferSize(
1293       final long handle, final long statsHistoryBufferSize);
statsHistoryBufferSize( final long handle)1294   private native long statsHistoryBufferSize(
1295       final long handle);
setAdviseRandomOnOpen( long handle, boolean adviseRandomOnOpen)1296   private native void setAdviseRandomOnOpen(
1297       long handle, boolean adviseRandomOnOpen);
adviseRandomOnOpen(long handle)1298   private native boolean adviseRandomOnOpen(long handle);
setDbWriteBufferSize(final long handle, final long dbWriteBufferSize)1299   private native void setDbWriteBufferSize(final long handle,
1300       final long dbWriteBufferSize);
setWriteBufferManager(final long dbOptionsHandle, final long writeBufferManagerHandle)1301   private native void setWriteBufferManager(final long dbOptionsHandle,
1302       final long writeBufferManagerHandle);
dbWriteBufferSize(final long handle)1303   private native long dbWriteBufferSize(final long handle);
setAccessHintOnCompactionStart(final long handle, final byte accessHintOnCompactionStart)1304   private native void setAccessHintOnCompactionStart(final long handle,
1305       final byte accessHintOnCompactionStart);
accessHintOnCompactionStart(final long handle)1306   private native byte accessHintOnCompactionStart(final long handle);
setNewTableReaderForCompactionInputs(final long handle, final boolean newTableReaderForCompactionInputs)1307   private native void setNewTableReaderForCompactionInputs(final long handle,
1308       final boolean newTableReaderForCompactionInputs);
newTableReaderForCompactionInputs(final long handle)1309   private native boolean newTableReaderForCompactionInputs(final long handle);
setCompactionReadaheadSize(final long handle, final long compactionReadaheadSize)1310   private native void setCompactionReadaheadSize(final long handle,
1311       final long compactionReadaheadSize);
compactionReadaheadSize(final long handle)1312   private native long compactionReadaheadSize(final long handle);
setRandomAccessMaxBufferSize(final long handle, final long randomAccessMaxBufferSize)1313   private native void setRandomAccessMaxBufferSize(final long handle,
1314       final long randomAccessMaxBufferSize);
randomAccessMaxBufferSize(final long handle)1315   private native long randomAccessMaxBufferSize(final long handle);
setWritableFileMaxBufferSize(final long handle, final long writableFileMaxBufferSize)1316   private native void setWritableFileMaxBufferSize(final long handle,
1317       final long writableFileMaxBufferSize);
writableFileMaxBufferSize(final long handle)1318   private native long writableFileMaxBufferSize(final long handle);
setUseAdaptiveMutex( long handle, boolean useAdaptiveMutex)1319   private native void setUseAdaptiveMutex(
1320       long handle, boolean useAdaptiveMutex);
useAdaptiveMutex(long handle)1321   private native boolean useAdaptiveMutex(long handle);
setBytesPerSync( long handle, long bytesPerSync)1322   private native void setBytesPerSync(
1323       long handle, long bytesPerSync);
bytesPerSync(long handle)1324   private native long bytesPerSync(long handle);
setWalBytesPerSync(long handle, long walBytesPerSync)1325   private native void setWalBytesPerSync(long handle, long walBytesPerSync);
walBytesPerSync(long handle)1326   private native long walBytesPerSync(long handle);
setStrictBytesPerSync( final long handle, final boolean strictBytesPerSync)1327   private native void setStrictBytesPerSync(
1328       final long handle, final boolean strictBytesPerSync);
strictBytesPerSync( final long handle)1329   private native boolean strictBytesPerSync(
1330       final long handle);
setEnableThreadTracking(long handle, boolean enableThreadTracking)1331   private native void setEnableThreadTracking(long handle,
1332       boolean enableThreadTracking);
enableThreadTracking(long handle)1333   private native boolean enableThreadTracking(long handle);
setDelayedWriteRate(long handle, long delayedWriteRate)1334   private native void setDelayedWriteRate(long handle, long delayedWriteRate);
delayedWriteRate(long handle)1335   private native long delayedWriteRate(long handle);
setEnablePipelinedWrite(final long handle, final boolean enablePipelinedWrite)1336   private native void setEnablePipelinedWrite(final long handle,
1337       final boolean enablePipelinedWrite);
enablePipelinedWrite(final long handle)1338   private native boolean enablePipelinedWrite(final long handle);
setUnorderedWrite(final long handle, final boolean unorderedWrite)1339   private native void setUnorderedWrite(final long handle,
1340       final boolean unorderedWrite);
unorderedWrite(final long handle)1341   private native boolean unorderedWrite(final long handle);
setAllowConcurrentMemtableWrite(long handle, boolean allowConcurrentMemtableWrite)1342   private native void setAllowConcurrentMemtableWrite(long handle,
1343       boolean allowConcurrentMemtableWrite);
allowConcurrentMemtableWrite(long handle)1344   private native boolean allowConcurrentMemtableWrite(long handle);
setEnableWriteThreadAdaptiveYield(long handle, boolean enableWriteThreadAdaptiveYield)1345   private native void setEnableWriteThreadAdaptiveYield(long handle,
1346       boolean enableWriteThreadAdaptiveYield);
enableWriteThreadAdaptiveYield(long handle)1347   private native boolean enableWriteThreadAdaptiveYield(long handle);
setWriteThreadMaxYieldUsec(long handle, long writeThreadMaxYieldUsec)1348   private native void setWriteThreadMaxYieldUsec(long handle,
1349       long writeThreadMaxYieldUsec);
writeThreadMaxYieldUsec(long handle)1350   private native long writeThreadMaxYieldUsec(long handle);
setWriteThreadSlowYieldUsec(long handle, long writeThreadSlowYieldUsec)1351   private native void setWriteThreadSlowYieldUsec(long handle,
1352       long writeThreadSlowYieldUsec);
writeThreadSlowYieldUsec(long handle)1353   private native long writeThreadSlowYieldUsec(long handle);
setSkipStatsUpdateOnDbOpen(final long handle, final boolean skipStatsUpdateOnDbOpen)1354   private native void setSkipStatsUpdateOnDbOpen(final long handle,
1355       final boolean skipStatsUpdateOnDbOpen);
skipStatsUpdateOnDbOpen(final long handle)1356   private native boolean skipStatsUpdateOnDbOpen(final long handle);
setWalRecoveryMode(final long handle, final byte walRecoveryMode)1357   private native void setWalRecoveryMode(final long handle,
1358       final byte walRecoveryMode);
walRecoveryMode(final long handle)1359   private native byte walRecoveryMode(final long handle);
setAllow2pc(final long handle, final boolean allow2pc)1360   private native void setAllow2pc(final long handle,
1361       final boolean allow2pc);
allow2pc(final long handle)1362   private native boolean allow2pc(final long handle);
setRowCache(final long handle, final long rowCacheHandle)1363   private native void setRowCache(final long handle,
1364       final long rowCacheHandle);
setWalFilter(final long handle, final long walFilterHandle)1365   private native void setWalFilter(final long handle,
1366       final long walFilterHandle);
setFailIfOptionsFileError(final long handle, final boolean failIfOptionsFileError)1367   private native void setFailIfOptionsFileError(final long handle,
1368       final boolean failIfOptionsFileError);
failIfOptionsFileError(final long handle)1369   private native boolean failIfOptionsFileError(final long handle);
setDumpMallocStats(final long handle, final boolean dumpMallocStats)1370   private native void setDumpMallocStats(final long handle,
1371       final boolean dumpMallocStats);
dumpMallocStats(final long handle)1372   private native boolean dumpMallocStats(final long handle);
setAvoidFlushDuringRecovery(final long handle, final boolean avoidFlushDuringRecovery)1373   private native void setAvoidFlushDuringRecovery(final long handle,
1374       final boolean avoidFlushDuringRecovery);
avoidFlushDuringRecovery(final long handle)1375   private native boolean avoidFlushDuringRecovery(final long handle);
setAvoidFlushDuringShutdown(final long handle, final boolean avoidFlushDuringShutdown)1376   private native void setAvoidFlushDuringShutdown(final long handle,
1377       final boolean avoidFlushDuringShutdown);
avoidFlushDuringShutdown(final long handle)1378   private native boolean avoidFlushDuringShutdown(final long handle);
setAllowIngestBehind(final long handle, final boolean allowIngestBehind)1379   private native void setAllowIngestBehind(final long handle,
1380       final boolean allowIngestBehind);
allowIngestBehind(final long handle)1381   private native boolean allowIngestBehind(final long handle);
setPreserveDeletes(final long handle, final boolean preserveDeletes)1382   private native void setPreserveDeletes(final long handle,
1383       final boolean preserveDeletes);
preserveDeletes(final long handle)1384   private native boolean preserveDeletes(final long handle);
setTwoWriteQueues(final long handle, final boolean twoWriteQueues)1385   private native void setTwoWriteQueues(final long handle,
1386       final boolean twoWriteQueues);
twoWriteQueues(final long handle)1387   private native boolean twoWriteQueues(final long handle);
setManualWalFlush(final long handle, final boolean manualWalFlush)1388   private native void setManualWalFlush(final long handle,
1389       final boolean manualWalFlush);
manualWalFlush(final long handle)1390   private native boolean manualWalFlush(final long handle);
setAtomicFlush(final long handle, final boolean atomicFlush)1391   private native void setAtomicFlush(final long handle,
1392       final boolean atomicFlush);
atomicFlush(final long handle)1393   private native boolean atomicFlush(final long handle);
1394 
1395   // instance variables
1396   // NOTE: If you add new member variables, please update the copy constructor above!
1397   private Env env_;
1398   private int numShardBits_;
1399   private RateLimiter rateLimiter_;
1400   private Cache rowCache_;
1401   private WalFilter walFilter_;
1402   private WriteBufferManager writeBufferManager_;
1403 }
1404