@@ -228,38 +228,6 @@ public void put(final T key, final T val) throws
228228 }
229229 }
230230
231- /**
232- * Reserve space for data of the given size, but don't copy the given val.
233- * Instead, return a pointer to the reserved space, which the caller can fill in later -
234- * before the next update operation or the transaction ends. This saves an extra memcpy
235- * if the data is being generated later. LMDB does nothing else with this memory,
236- * the caller is expected to modify all of the space requested.
237- *
238- * This flag must not be specified if the database was opened with MDB_DUPSORT
239- *
240- * @param txn transaction handle (not null; not committed; must be R-W)
241- * @param key key to store in the database (not null)
242- * @param val size of the value to be stored in the database (not null)
243- * @throws CommittedException
244- * @throws LmdbNativeException
245- * @throws ReadWriteRequiredException
246- */
247- public void reserve (Txn <T > txn , final T key , final T val )
248- throws CommittedException , LmdbNativeException ,
249- ReadWriteRequiredException {
250- if (SHOULD_CHECK ) {
251- requireNonNull (txn );
252- requireNonNull (key );
253- txn .checkNotCommitted ();
254- txn .checkWritesAllowed ();
255- }
256- txn .keyIn (key );
257- txn .valIn (val );
258- final int mask = mask (MDB_RESERVE );
259- checkRc (LIB .mdb_put (txn .ptr , dbi , txn .ptrKey , txn .ptrVal , mask ));
260- txn .valOut (val ); // marked as in,out in LMDB C docs
261- }
262-
263231 /**
264232 * Store a key/value pair in the database.
265233 * <p>
@@ -294,6 +262,39 @@ public void put(final Txn<T> txn, final T key, final T val,
294262 txn .valOut (); // marked as in,out in LMDB C docs
295263 }
296264
265+ /**
266+ * Reserve space for data of the given size, but don't copy the given val.
267+ * Instead, return a pointer to the reserved space, which the caller can fill
268+ * in later - before the next update operation or the transaction ends. This
269+ * saves an extra memcpy if the data is being generated later. LMDB does
270+ * nothing else with this memory, the caller is expected to modify all of the
271+ * space requested.
272+ * <p>
273+ * This flag must not be specified if the database was opened with MDB_DUPSORT
274+ *
275+ * @param txn transaction handle (not null; not committed; must be R-W)
276+ * @param key key to store in the database (not null)
277+ * @param val size of the value to be stored in the database (not null)
278+ * @throws CommittedException if already committed
279+ * @throws LmdbNativeException if a native C error occurred
280+ * @throws ReadWriteRequiredException if a read-only transaction presented
281+ */
282+ public void reserve (Txn <T > txn , final T key , final T val )
283+ throws CommittedException , LmdbNativeException ,
284+ ReadWriteRequiredException {
285+ if (SHOULD_CHECK ) {
286+ requireNonNull (txn );
287+ requireNonNull (key );
288+ txn .checkNotCommitted ();
289+ txn .checkWritesAllowed ();
290+ }
291+ txn .keyIn (key );
292+ txn .valIn (val );
293+ final int mask = mask (MDB_RESERVE );
294+ checkRc (LIB .mdb_put (txn .ptr , dbi , txn .ptrKey , txn .ptrVal , mask ));
295+ txn .valOut (val ); // marked as in,out in LMDB C docs
296+ }
297+
297298 /**
298299 * The specified DBI was changed unexpectedly.
299300 */
0 commit comments