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