@@ -34,7 +34,7 @@ public Options() {
34
34
* @see RocksDB::Open()
35
35
*/
36
36
public void setCreateIfMissing (boolean flag ) {
37
- checkInitialization ( );
37
+ assert ( isInitialized () );
38
38
setCreateIfMissing (nativeHandle_ , flag );
39
39
}
40
40
@@ -46,140 +46,141 @@ public void setCreateIfMissing(boolean flag) {
46
46
* @see setCreateIfMissing()
47
47
*/
48
48
public boolean createIfMissing () {
49
- checkInitialization ( );
49
+ assert ( isInitialized () );
50
50
return createIfMissing (nativeHandle_ );
51
51
}
52
-
52
+
53
53
/**
54
54
* Amount of data to build up in memory (backed by an unsorted log
55
55
* on disk) before converting to a sorted on-disk file.
56
- *
56
+ *
57
57
* Larger values increase performance, especially during bulk loads.
58
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
59
+ * at the same time, so you may wish to adjust this parameter
60
60
* to control memory usage.
61
- *
61
+ *
62
62
* Also, a larger write buffer will result in a longer recovery time
63
63
* the next time the database is opened.
64
- *
64
+ *
65
65
* Default: 4MB
66
66
* @param size of write buffer
67
67
* @see RocksDB::Open()
68
- */
68
+ */
69
69
public void setWriteBufferSize (int writeBufferSize ) {
70
- checkInitialization ( );
70
+ assert ( isInitialized () );
71
71
setWriteBufferSize (nativeHandle_ , writeBufferSize );
72
72
}
73
-
73
+
74
74
/**
75
75
* Return size of write buffer size.
76
76
*
77
77
* @return size of write buffer.
78
78
* @see setWriteBufferSize()
79
79
*/
80
80
public int writeBufferSize () {
81
- checkInitialization ( );
81
+ assert ( isInitialized () );
82
82
return writeBufferSize (nativeHandle_ );
83
83
}
84
-
84
+
85
85
/**
86
86
* The maximum number of write buffers that are built up in memory.
87
87
* The default is 2, so that when 1 write buffer is being flushed to
88
88
* storage, new writes can continue to the other write buffer.
89
89
* Default: 2
90
- *
90
+ *
91
91
* @param maximum number of write buffers
92
92
* @see RocksDB::Open()
93
93
*/
94
94
public void setMaxWriteBufferNumber (int maxWriteBufferNumber ) {
95
- checkInitialization ( );
95
+ assert ( isInitialized () );
96
96
setMaxWriteBufferNumber (nativeHandle_ , maxWriteBufferNumber );
97
97
}
98
-
98
+
99
99
/**
100
100
* Returns maximum number of write buffers.
101
- *
101
+ *
102
102
* @return maximum number of write buffers.
103
103
* @see setMaxWriteBufferNumber()
104
104
*/
105
105
public int maxWriteBufferNumber () {
106
- checkInitialization ( );
106
+ assert ( isInitialized () );
107
107
return maxWriteBufferNumber (nativeHandle_ );
108
108
}
109
-
109
+
110
110
/*
111
111
* Approximate size of user data packed per block. Note that the
112
112
* block size specified here corresponds to uncompressed data. The
113
113
* actual size of the unit read from disk may be smaller if
114
114
* compression is enabled. This parameter can be changed dynamically.
115
- *
115
+ *
116
116
* Default: 4K
117
- *
117
+ *
118
118
* @param block size
119
119
* @see RocksDB::Open()
120
120
*/
121
121
public void setBlockSize (int blockSize ) {
122
- checkInitialization ( );
122
+ assert ( isInitialized () );
123
123
setBlockSize (nativeHandle_ , blockSize );
124
124
}
125
-
125
+
126
126
/*
127
127
* Returns block size.
128
- *
128
+ *
129
129
* @return block size.
130
- * @see setBlockSize()
130
+ * @see setBlockSize()
131
131
*/
132
132
public int blockSize () {
133
- checkInitialization ( );
133
+ assert ( isInitialized () );
134
134
return blockSize (nativeHandle_ );
135
135
}
136
-
136
+
137
137
/*
138
138
* Disable compaction triggered by seek.
139
139
* With bloomfilter and fast storage, a miss on one level
140
140
* is very cheap if the file handle is cached in table cache
141
141
* (which is true if max_open_files is large).
142
- *
142
+ * Default: true
143
+ *
143
144
* @param disable seek compaction
144
145
* @see RocksDB::Open()
145
146
*/
146
147
public void setDisableSeekCompaction (boolean disableSeekCompaction ) {
147
- checkInitialization ( );
148
+ assert ( isInitialized () );
148
149
setDisableSeekCompaction (nativeHandle_ , disableSeekCompaction );
149
150
}
150
-
151
+
151
152
/*
152
153
* Returns true if disable seek compaction is set to true.
153
- *
154
+ *
154
155
* @return true if disable seek compaction is set to true.
155
156
* @see setDisableSeekCompaction()
156
157
*/
157
158
public boolean disableSeekCompaction () {
158
- checkInitialization ( );
159
+ assert ( isInitialized () );
159
160
return disableSeekCompaction (nativeHandle_ );
160
161
}
161
-
162
+
162
163
/*
163
164
* Maximum number of concurrent background jobs, submitted to
164
165
* the default LOW priority thread pool
165
166
* Default: 1
166
- *
167
+ *
167
168
* @param maximum number of concurrent background jobs.
168
169
* @see RocksDB::Open()
169
170
*/
170
171
public void setMaxBackgroundCompactions (int maxBackgroundCompactions ) {
171
- checkInitialization ( );
172
+ assert ( isInitialized () );
172
173
setMaxBackgroundCompactions (nativeHandle_ , maxBackgroundCompactions );
173
174
}
174
-
175
+
175
176
/*
176
177
* Returns maximum number of background concurrent jobs
177
- *
178
+ *
178
179
* @return maximum number of background concurrent jobs
179
180
* @see setMaxBackgroundCompactions
180
181
*/
181
182
public int maxBackgroundCompactions () {
182
- checkInitialization ();
183
+ assert ( isInitialized ());
183
184
return maxBackgroundCompactions (nativeHandle_ );
184
185
}
185
186
@@ -192,25 +193,25 @@ public synchronized void dispose() {
192
193
dispose0 ();
193
194
}
194
195
}
195
-
196
- private void checkInitialization () {
197
- assert (nativeHandle_ != 0 );
196
+
197
+ private boolean isInitialized () {
198
+ return (nativeHandle_ != 0 );
198
199
}
199
200
200
201
private native void newOptions ();
201
202
private native void dispose0 ();
202
203
private native void setCreateIfMissing (long handle , boolean flag );
203
204
private native boolean createIfMissing (long handle );
204
205
private native void setWriteBufferSize (long handle , int writeBufferSize );
205
- private native int writeBufferSize (long handle );
206
+ private native int writeBufferSize (long handle );
206
207
private native void setMaxWriteBufferNumber (long handle , int maxWriteBufferNumber );
207
208
private native int maxWriteBufferNumber (long handle );
208
209
private native void setBlockSize (long handle , int blockSize );
209
210
private native int blockSize (long handle );
210
211
private native void setDisableSeekCompaction (long handle , boolean disableSeekCompaction );
211
212
private native boolean disableSeekCompaction (long handle );
212
213
private native void setMaxBackgroundCompactions (long handle , int maxBackgroundCompactions );
213
- private native int maxBackgroundCompactions (long handle );
214
+ private native int maxBackgroundCompactions (long handle );
214
215
215
216
long nativeHandle_ ;
216
217
}
0 commit comments