Clarifications

This commit is contained in:
Andrea Cavalli 2023-12-09 17:57:02 +01:00
parent 665e5cdf30
commit 4a4af2576d
3 changed files with 6 additions and 6 deletions

View File

@ -70,7 +70,7 @@ public abstract class SocketConnection extends BaseConnection {
@Override @Override
public <T> T get(Arena arena, public <T> T get(Arena arena,
long transactionId, long transactionOrUpdateId,
long columnId, long columnId,
MemorySegment @NotNull [] keys, MemorySegment @NotNull [] keys,
GetCallback<? super MemorySegment, T> callback) throws RocksDBException { GetCallback<? super MemorySegment, T> callback) throws RocksDBException {

View File

@ -73,13 +73,13 @@ public interface RocksDBAPI {
/** /**
* Get an element from the specified position * Get an element from the specified position
* @param arena arena * @param arena arena
* @param transactionId transaction id, update id for retry operations, or 0 * @param transactionOrUpdateId transaction id, update id for retry operations, or 0
* @param columnId column id * @param columnId column id
* @param keys column keys, or empty array if not needed * @param keys column keys, or empty array if not needed
* @param callback the callback will be executed on the same thread, exactly once. * @param callback the callback will be executed on the same thread, exactly once.
*/ */
<T> T get(Arena arena, <T> T get(Arena arena,
long transactionId, long transactionOrUpdateId,
long columnId, long columnId,
@NotNull MemorySegment @NotNull[] keys, @NotNull MemorySegment @NotNull[] keys,
GetCallback<? super MemorySegment, T> callback) throws RocksDBException; GetCallback<? super MemorySegment, T> callback) throws RocksDBException;

View File

@ -481,20 +481,20 @@ public class EmbeddedDB implements RocksDBAPI, Closeable {
@Override @Override
public <T> T get(Arena arena, public <T> T get(Arena arena,
long transactionId, long transactionOrUpdateId,
long columnId, long columnId,
MemorySegment @NotNull [] keys, MemorySegment @NotNull [] keys,
GetCallback<? super MemorySegment, T> callback) throws it.cavallium.rockserver.core.common.RocksDBException { GetCallback<? super MemorySegment, T> callback) throws it.cavallium.rockserver.core.common.RocksDBException {
// Column id // Column id
var col = getColumn(columnId); var col = getColumn(columnId);
Tx tx = transactionId != 0 ? getTransaction(transactionId, true) : null; Tx tx = transactionOrUpdateId != 0 ? getTransaction(transactionOrUpdateId, true) : null;
long updateId; long updateId;
if (callback instanceof Callback.CallbackForUpdate<?>) { if (callback instanceof Callback.CallbackForUpdate<?>) {
if (tx == null) { if (tx == null) {
tx = openTransactionInternal(MAX_TRANSACTION_DURATION_MS, true); tx = openTransactionInternal(MAX_TRANSACTION_DURATION_MS, true);
updateId = allocateTransactionInternal(tx); updateId = allocateTransactionInternal(tx);
} else { } else {
updateId = transactionId; updateId = transactionOrUpdateId;
} }
} else { } else {
updateId = 0; updateId = 0;