MCPcopy Create free account
hub / github.com/bytedance/terarkdb / WriteOptions

Class WriteOptions

java/src/main/java/org/rocksdb/WriteOptions.java:14–179  ·  view source on GitHub ↗

Options that control write operations. Note that developers should call WriteOptions.dispose() to release the c++ side memory before a WriteOptions instance runs out of scope.

Source from the content-addressed store, hash-verified

12 * c++ side memory before a WriteOptions instance runs out of scope.
13 */
14public class WriteOptions extends RocksObject {
15 /**
16 * Construct WriteOptions instance.
17 */
18 public WriteOptions() {
19 super(newWriteOptions());
20
21 }
22
23 // TODO(AR) consider ownership
24 WriteOptions(final long nativeHandle) {
25 super(nativeHandle);
26 disOwnNativeHandle();
27 }
28
29 /**
30 * Copy constructor for WriteOptions.
31 *
32 * NOTE: This does a shallow copy, which means comparator, merge_operator, compaction_filter,
33 * compaction_filter_factory and other pointers will be cloned!
34 *
35 * @param other The ColumnFamilyOptions to copy.
36 */
37 public WriteOptions(WriteOptions other) {
38 super(copyWriteOptions(other.nativeHandle_));
39 }
40
41
42 /**
43 * If true, the write will be flushed from the operating system
44 * buffer cache (by calling WritableFile::Sync()) before the write
45 * is considered complete. If this flag is true, writes will be
46 * slower.
47 *
48 * If this flag is false, and the machine crashes, some recent
49 * writes may be lost. Note that if it is just the process that
50 * crashes (i.e., the machine does not reboot), no writes will be
51 * lost even if sync==false.
52 *
53 * In other words, a DB write with sync==false has similar
54 * crash semantics as the "write()" system call. A DB write
55 * with sync==true has similar crash semantics to a "write()"
56 * system call followed by "fdatasync()".
57 *
58 * Default: false
59 *
60 * @param flag a boolean flag to indicate whether a write
61 * should be synchronized.
62 * @return the instance of the current WriteOptions.
63 */
64 public WriteOptions setSync(final boolean flag) {
65 setSync(nativeHandle_, flag);
66 return this;
67 }
68
69 /**
70 * If true, the write will be flushed from the operating system
71 * buffer cache (by calling WritableFile::Sync()) before the write

Calls

no outgoing calls

Tested by

no test coverage detected