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