@@ -34,7 +34,7 @@ public Options() {
34
34
* @see RocksDB::Open()
35
35
*/
36
36
public void setCreateIfMissing (boolean flag ) {
37
- assert ( nativeHandle_ != 0 );
37
+ checkInitialization ( );
38
38
setCreateIfMissing (nativeHandle_ , flag );
39
39
}
40
40
@@ -45,10 +45,97 @@ public void setCreateIfMissing(boolean flag) {
45
45
* @return return true if the create_if_missing flag is set to true.
46
46
* @see setCreateIfMissing()
47
47
*/
48
- public boolean craeteIfMissing () {
49
- assert ( nativeHandle_ != 0 );
48
+ public boolean createIfMissing () {
49
+ checkInitialization ( );
50
50
return createIfMissing (nativeHandle_ );
51
51
}
52
+
53
+ /**
54
+ * Amount of data to build up in memory (backed by an unsorted log
55
+ * on disk) before converting to a sorted on-disk file.
56
+ *
57
+ * Larger values increase performance, especially during bulk loads.
58
+ * Up to max_write_buffer_number write buffers may be held in memory
59
+ * at the same time, so you may wish to adjust this parameter
60
+ * to control memory usage.
61
+ *
62
+ * Also, a larger write buffer will result in a longer recovery time
63
+ * the next time the database is opened.
64
+ *
65
+ * Default: 4MB
66
+ * @param size of write buffer
67
+ * @see RocksDB::Open()
68
+ */
69
+ public void setWriteBufferSize (int writeBufferSize ) {
70
+ checkInitialization ();
71
+ setWriteBufferSize (nativeHandle_ , writeBufferSize );
72
+ }
73
+
74
+ /**
75
+ * Return size of write buffer size.
76
+ *
77
+ * @return size of write buffer.
78
+ * @see setWriteBufferSize()
79
+ */
80
+ public int writeBufferSize () {
81
+ checkInitialization ();
82
+ return writeBufferSize (nativeHandle_ );
83
+ }
84
+
85
+ /**
86
+ * The maximum number of write buffers that are built up in memory.
87
+ * The default is 2, so that when 1 write buffer is being flushed to
88
+ * storage, new writes can continue to the other write buffer.
89
+ * Default: 2
90
+ *
91
+ * @param maximum number of write buffers
92
+ * @see RocksDB::Open()
93
+ */
94
+ public void setMaxWriteBufferNumber (int maxWriteBufferNumber ) {
95
+ checkInitialization ();
96
+ setMaxWriteBufferNumber (nativeHandle_ , maxWriteBufferNumber );
97
+ }
98
+
99
+ /**
100
+ * Returns maximum number of write buffers.
101
+ *
102
+ * @return maximum number of write buffers.
103
+ * @see setMaxWriteBufferNumber()
104
+ */
105
+ public int maxWriteBufferNumber () {
106
+ checkInitialization ();
107
+ return maxWriteBufferNumber (nativeHandle_ );
108
+ }
109
+
110
+ public void setBlockSize (int blockSize ) {
111
+ checkInitialization ();
112
+ setBlockSize (nativeHandle_ , blockSize );
113
+ }
114
+
115
+ public int blockSize () {
116
+ checkInitialization ();
117
+ return blockSize (nativeHandle_ );
118
+ }
119
+
120
+ public void setDisableSeekCompaction (boolean disableSeekCompaction ) {
121
+ checkInitialization ();
122
+ setDisableSeekCompaction (nativeHandle_ , disableSeekCompaction );
123
+ }
124
+
125
+ public boolean disableSeekCompaction () {
126
+ checkInitialization ();
127
+ return disableSeekCompaction (nativeHandle_ );
128
+ }
129
+
130
+ public void setMaxBackgroundCompactions (int maxBackgroundCompactions ) {
131
+ checkInitialization ();
132
+ setMaxBackgroundCompactions (nativeHandle_ , maxBackgroundCompactions );
133
+ }
134
+
135
+ public int maxBackgroundCompactions () {
136
+ checkInitialization ();
137
+ return maxBackgroundCompactions (nativeHandle_ );
138
+ }
52
139
53
140
/**
54
141
* Release the memory allocated for the current instance
@@ -59,11 +146,25 @@ public synchronized void dispose() {
59
146
dispose0 ();
60
147
}
61
148
}
149
+
150
+ private void checkInitialization () {
151
+ assert (nativeHandle_ != 0 );
152
+ }
62
153
63
154
private native void newOptions ();
64
155
private native void dispose0 ();
65
156
private native void setCreateIfMissing (long handle , boolean flag );
66
157
private native boolean createIfMissing (long handle );
158
+ private native void setWriteBufferSize (long handle , int writeBufferSize );
159
+ private native int writeBufferSize (long handle );
160
+ private native void setMaxWriteBufferNumber (long handle , int maxWriteBufferNumber );
161
+ private native int maxWriteBufferNumber (long handle );
162
+ private native void setBlockSize (long handle , int blockSize );
163
+ private native int blockSize (long handle );
164
+ private native void setDisableSeekCompaction (long handle , boolean disableSeekCompaction );
165
+ private native boolean disableSeekCompaction (long handle );
166
+ private native void setMaxBackgroundCompactions (long handle , int maxBackgroundCompactions );
167
+ private native int maxBackgroundCompactions (long handle );
67
168
68
169
long nativeHandle_ ;
69
170
}
0 commit comments