mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Resolved the review comment and renamed the functions
This commit is contained in:
parent
5d30296db8
commit
d20ce99774
@ -628,10 +628,10 @@ fdb_error_t fdb_transaction_add_conflict_range( FDBTransaction*tr, uint8_t const
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" DLLEXPORT
|
extern "C" DLLEXPORT
|
||||||
FDBFuture* fdb_transaction_get_storage_byte_sample( FDBTransaction* tr, uint8_t const* begin_key_name,
|
FDBFuture* fdb_transaction_get_estimated_range_size_bytes( FDBTransaction* tr, uint8_t const* begin_key_name,
|
||||||
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length ) {
|
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length ) {
|
||||||
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
|
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
|
||||||
return (FDBFuture*)(TXN(tr)->getStorageByteSample(range).extractPtr());
|
return (FDBFuture*)(TXN(tr)->getEstimatedRangeSizeBytes(range).extractPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "fdb_c_function_pointers.g.h"
|
#include "fdb_c_function_pointers.g.h"
|
||||||
|
@ -257,7 +257,7 @@ extern "C" {
|
|||||||
FDBConflictRangeType type);
|
FDBConflictRangeType type);
|
||||||
|
|
||||||
DLLEXPORT WARN_UNUSED_RESULT FDBFuture*
|
DLLEXPORT WARN_UNUSED_RESULT FDBFuture*
|
||||||
fdb_transaction_get_storage_byte_sample( FDBTransaction* tr, uint8_t const* begin_key_name,
|
fdb_transaction_get_estimated_range_size_bytes( FDBTransaction* tr, uint8_t const* begin_key_name,
|
||||||
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length);
|
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length);
|
||||||
|
|
||||||
#define FDB_KEYSEL_LAST_LESS_THAN(k, l) k, l, 0, 0
|
#define FDB_KEYSEL_LAST_LESS_THAN(k, l) k, l, 0, 0
|
||||||
|
@ -132,7 +132,7 @@ namespace FDB {
|
|||||||
bool reverse = false,
|
bool reverse = false,
|
||||||
FDBStreamingMode streamingMode = FDB_STREAMING_MODE_SERIAL) override;
|
FDBStreamingMode streamingMode = FDB_STREAMING_MODE_SERIAL) override;
|
||||||
|
|
||||||
Future<int64_t> getStorageByteSample(const KeyRange& keys) override;
|
Future<int64_t> getEstimatedRangeSizeBytes(const KeyRange& keys) override;
|
||||||
|
|
||||||
void addReadConflictRange(KeyRangeRef const& keys) override;
|
void addReadConflictRange(KeyRangeRef const& keys) override;
|
||||||
void addReadConflictKey(KeyRef const& key) override;
|
void addReadConflictKey(KeyRef const& key) override;
|
||||||
@ -347,8 +347,8 @@ namespace FDB {
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int64_t> TransactionImpl::getStorageByteSample(const KeyRange& keys) {
|
Future<int64_t> TransactionImpl::getEstimatedRangeSizeBytes(const KeyRange& keys) {
|
||||||
return backToFuture<int64_t>(fdb_transaction_get_storage_byte_sample(tr, keys.begin.begin(), keys.begin.size(), keys.end.begin(), keys.end.size()), [](Reference<CFuture> f) {
|
return backToFuture<int64_t>(fdb_transaction_get_estimated_range_size_bytes(tr, keys.begin.begin(), keys.begin.size(), keys.end.begin(), keys.end.size()), [](Reference<CFuture> f) {
|
||||||
int64_t bytes;
|
int64_t bytes;
|
||||||
throw_on_error(fdb_future_get_int64(f->f, &bytes));
|
throw_on_error(fdb_future_get_int64(f->f, &bytes));
|
||||||
return bytes;
|
return bytes;
|
||||||
|
@ -89,7 +89,7 @@ namespace FDB {
|
|||||||
streamingMode);
|
streamingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Future<int64_t> getStorageByteSample(const KeyRange& keys) = 0;
|
virtual Future<int64_t> getEstimatedRangeSizeBytes(const KeyRange& keys) = 0;
|
||||||
|
|
||||||
virtual void addReadConflictRange(KeyRangeRef const& keys) = 0;
|
virtual void addReadConflictRange(KeyRangeRef const& keys) = 0;
|
||||||
virtual void addReadConflictKey(KeyRef const& key) = 0;
|
virtual void addReadConflictKey(KeyRef const& key) = 0;
|
||||||
|
@ -87,9 +87,9 @@ func (s Snapshot) GetDatabase() Database {
|
|||||||
return s.transaction.db
|
return s.transaction.db
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Snapshot) GetStorageByteSample(r Range) FutureInt64 {
|
func (s Snapshot) GetEstimatedRangeSizeBytes(r Range) FutureInt64 {
|
||||||
begin, end := r.FDBRangeKeySelectors()
|
begin, end := r.FDBRangeKeySelectors()
|
||||||
return s.getStorageByteSample(
|
return s.getEstimatedRangeSizeBytes(
|
||||||
begin.FDBKeySelector().Key.FDBKey(),
|
begin.FDBKeySelector().Key.FDBKey(),
|
||||||
end.FDBKeySelector().Key.FDBKey(),
|
end.FDBKeySelector().Key.FDBKey(),
|
||||||
)
|
)
|
||||||
|
@ -39,7 +39,7 @@ type ReadTransaction interface {
|
|||||||
GetReadVersion() FutureInt64
|
GetReadVersion() FutureInt64
|
||||||
GetDatabase() Database
|
GetDatabase() Database
|
||||||
Snapshot() Snapshot
|
Snapshot() Snapshot
|
||||||
GetStorageByteSample(r Range) FutureInt64
|
GetEstimatedRangeSizeBytes(r Range) FutureInt64
|
||||||
|
|
||||||
ReadTransactor
|
ReadTransactor
|
||||||
}
|
}
|
||||||
@ -306,9 +306,9 @@ func (t Transaction) GetRange(r Range, options RangeOptions) RangeResult {
|
|||||||
return t.getRange(r, options, false)
|
return t.getRange(r, options, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *transaction) getStorageByteSample(beginKey Key, endKey Key) FutureInt64 {
|
func (t *transaction) getEstimatedRangeSizeBytes(beginKey Key, endKey Key) FutureInt64 {
|
||||||
return &futureInt64{
|
return &futureInt64{
|
||||||
future: newFuture(C.fdb_transaction_get_storage_byte_sample(
|
future: newFuture(C.fdb_transaction_get_estimated_range_size_bytes(
|
||||||
t.ptr,
|
t.ptr,
|
||||||
byteSliceToPtr(beginKey),
|
byteSliceToPtr(beginKey),
|
||||||
C.int(len(beginKey)),
|
C.int(len(beginKey)),
|
||||||
@ -318,11 +318,11 @@ func (t *transaction) getStorageByteSample(beginKey Key, endKey Key) FutureInt64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStorageByteSample will get the byte size of the key range based on the
|
// GetEstimatedRangeSizeBytes will get the byte size of the key range based on the
|
||||||
// byte sample collected by FDB
|
// byte sample collected by FDB
|
||||||
func (t Transaction) GetStorageByteSample(r Range) FutureInt64 {
|
func (t Transaction) GetEstimatedRangeSizeBytes(r Range) FutureInt64 {
|
||||||
begin, end := r.FDBRangeKeySelectors()
|
begin, end := r.FDBRangeKeySelectors()
|
||||||
return t.getStorageByteSample(
|
return t.getEstimatedRangeSizeBytes(
|
||||||
begin.FDBKeySelector().Key.FDBKey(),
|
begin.FDBKeySelector().Key.FDBKey(),
|
||||||
end.FDBKeySelector().Key.FDBKey(),
|
end.FDBKeySelector().Key.FDBKey(),
|
||||||
)
|
)
|
||||||
|
@ -646,7 +646,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1
|
|||||||
return (jlong)f;
|
return (jlong)f;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getStorageByteSample(JNIEnv *jenv, jobject, jlong tPtr,
|
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getEstimatedRangeSizeBytes(JNIEnv *jenv, jobject, jlong tPtr,
|
||||||
jbyteArray beginKeyBytes, jbyteArray endKeyBytes) {
|
jbyteArray beginKeyBytes, jbyteArray endKeyBytes) {
|
||||||
if( !tPtr || !beginKeyBytes || !endKeyBytes) {
|
if( !tPtr || !beginKeyBytes || !endKeyBytes) {
|
||||||
throwParamNotNull(jenv);
|
throwParamNotNull(jenv);
|
||||||
@ -669,7 +669,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FDBFuture *f = fdb_transaction_get_storage_byte_sample( tr, startKey, jenv->GetArrayLength( beginKeyBytes ), endKey, jenv->GetArrayLength( endKeyBytes ) );
|
FDBFuture *f = fdb_transaction_get_estimated_range_size_bytes( tr, startKey, jenv->GetArrayLength( beginKeyBytes ), endKey, jenv->GetArrayLength( endKeyBytes ) );
|
||||||
jenv->ReleaseByteArrayElements( beginKeyBytes, (jbyte *)startKey, JNI_ABORT );
|
jenv->ReleaseByteArrayElements( beginKeyBytes, (jbyte *)startKey, JNI_ABORT );
|
||||||
jenv->ReleaseByteArrayElements( endKeyBytes, (jbyte *)endKey, JNI_ABORT );
|
jenv->ReleaseByteArrayElements( endKeyBytes, (jbyte *)endKey, JNI_ABORT );
|
||||||
return (jlong)f;
|
return (jlong)f;
|
||||||
|
@ -71,10 +71,10 @@ class FDBTransaction extends NativeObjectWrapper implements Transaction, OptionC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Long> getStorageByteSample(byte[] begin, byte[] end) {
|
public CompletableFuture<Long> getEstimatedRangeSizeBytes(byte[] begin, byte[] end) {
|
||||||
pointerReadLock.lock();
|
pointerReadLock.lock();
|
||||||
try {
|
try {
|
||||||
return new FutureInt64(Transaction_getStorageByteSample(getPtr(), begin, end), executor);
|
return new FutureInt64(Transaction_getEstimatedRangeSizeBytes(getPtr(), begin, end), executor);
|
||||||
} finally {
|
} finally {
|
||||||
pointerReadLock.unlock();
|
pointerReadLock.unlock();
|
||||||
}
|
}
|
||||||
@ -268,10 +268,10 @@ class FDBTransaction extends NativeObjectWrapper implements Transaction, OptionC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Long> getStorageByteSample(byte[] begin, byte[] end) {
|
public CompletableFuture<Long> getEstimatedRangeSizeBytes(byte[] begin, byte[] end) {
|
||||||
pointerReadLock.lock();
|
pointerReadLock.lock();
|
||||||
try {
|
try {
|
||||||
return new FutureInt64(Transaction_getStorageByteSample(getPtr(), begin, end), executor);
|
return new FutureInt64(Transaction_getEstimatedRangeSizeBytes(getPtr(), begin, end), executor);
|
||||||
} finally {
|
} finally {
|
||||||
pointerReadLock.unlock();
|
pointerReadLock.unlock();
|
||||||
}
|
}
|
||||||
@ -679,5 +679,5 @@ class FDBTransaction extends NativeObjectWrapper implements Transaction, OptionC
|
|||||||
private native long Transaction_watch(long ptr, byte[] key) throws FDBException;
|
private native long Transaction_watch(long ptr, byte[] key) throws FDBException;
|
||||||
private native void Transaction_cancel(long cPtr);
|
private native void Transaction_cancel(long cPtr);
|
||||||
private native long Transaction_getKeyLocations(long cPtr, byte[] key);
|
private native long Transaction_getKeyLocations(long cPtr, byte[] key);
|
||||||
private native long Transaction_getStorageByteSample(long cPtr, byte[] keyBegin, byte[] keyEnd);
|
private native long Transaction_getEstimatedRangeSizeBytes(long cPtr, byte[] keyBegin, byte[] keyEnd);
|
||||||
}
|
}
|
||||||
|
@ -414,14 +414,14 @@ public interface ReadTransaction extends ReadTransactionContext {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sample byte size for the given key range.
|
* Gets the estimated byte size for the given key range based on the byte sample collcted.
|
||||||
*
|
*
|
||||||
* @param begin the beginning of the range (inclusive)
|
* @param begin the beginning of the range (inclusive)
|
||||||
* @param end the end of the range (exclusive)
|
* @param end the end of the range (exclusive)
|
||||||
*
|
*
|
||||||
* @return a handle to access the results of the asynchronous call
|
* @return a handle to access the results of the asynchronous call
|
||||||
*/
|
*/
|
||||||
CompletableFuture<Long> getStorageByteSample(byte[] begin, byte[] end);
|
CompletableFuture<Long> getEstimatedRangeSizeBytes(byte[] begin, byte[] end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set of options that can be set on a {@code Transaction}
|
* Returns a set of options that can be set on a {@code Transaction}
|
||||||
|
@ -450,12 +450,12 @@ class TransactionRead(_FDBBase):
|
|||||||
return self.get_range(key.start, key.stop, reverse=(key.step == -1))
|
return self.get_range(key.start, key.stop, reverse=(key.step == -1))
|
||||||
return self.get(key)
|
return self.get(key)
|
||||||
|
|
||||||
def get_storage_byte_sample(self, beginKey, endKey):
|
def get_estimated_range_size_bytes(self, beginKey, endKey):
|
||||||
if begin is None:
|
if begin is None:
|
||||||
begin = b''
|
begin = b''
|
||||||
if end is None:
|
if end is None:
|
||||||
end = b'\xff'
|
end = b'\xff'
|
||||||
return FutureInt64(self.capi.fdb_transaction_get_storage_byte_sample(
|
return FutureInt64(self.capi.fdb_transaction_get_estimated_range_size_bytes(
|
||||||
self.tpointer,
|
self.tpointer,
|
||||||
beginKey, len(beginKey),
|
beginKey, len(beginKey),
|
||||||
endKey, len(endKey)
|
endKey, len(endKey)
|
||||||
@ -1435,8 +1435,8 @@ def init_c_api():
|
|||||||
ctypes.c_int, ctypes.c_int]
|
ctypes.c_int, ctypes.c_int]
|
||||||
_capi.fdb_transaction_get_range.restype = ctypes.c_void_p
|
_capi.fdb_transaction_get_range.restype = ctypes.c_void_p
|
||||||
|
|
||||||
_capi.fdb_transaction_get_storage_byte_sample.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int]
|
_capi.fdb_transaction_get_estimated_range_size_bytes.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int]
|
||||||
_capi.fdb_transaction_get_range.restype = ctypes.c_void_p
|
_capi.fdb_transaction_get_estimated_range_size_bytes.restype = ctypes.c_void_p
|
||||||
|
|
||||||
_capi.fdb_transaction_add_conflict_range.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_int]
|
_capi.fdb_transaction_add_conflict_range.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_int]
|
||||||
_capi.fdb_transaction_add_conflict_range.restype = ctypes.c_int
|
_capi.fdb_transaction_add_conflict_range.restype = ctypes.c_int
|
||||||
|
@ -108,7 +108,7 @@ module FDB
|
|||||||
attach_function :fdb_transaction_get, [ :pointer, :pointer, :int, :int ], :pointer
|
attach_function :fdb_transaction_get, [ :pointer, :pointer, :int, :int ], :pointer
|
||||||
attach_function :fdb_transaction_get_key, [ :pointer, :pointer, :int, :int, :int, :int ], :pointer
|
attach_function :fdb_transaction_get_key, [ :pointer, :pointer, :int, :int, :int, :int ], :pointer
|
||||||
attach_function :fdb_transaction_get_range, [ :pointer, :pointer, :int, :int, :int, :pointer, :int, :int, :int, :int, :int, :int, :int, :int, :int ], :pointer
|
attach_function :fdb_transaction_get_range, [ :pointer, :pointer, :int, :int, :int, :pointer, :int, :int, :int, :int, :int, :int, :int, :int, :int ], :pointer
|
||||||
attach_function :fdb_transaction_get_storage_byte_sample, [ :pointer, :pointer, :int, :pointer, :int ], :pointer
|
attach_function :fdb_transaction_get_estimated_range_size_bytes, [ :pointer, :pointer, :int, :pointer, :int ], :pointer
|
||||||
attach_function :fdb_transaction_set, [ :pointer, :pointer, :int, :pointer, :int ], :void
|
attach_function :fdb_transaction_set, [ :pointer, :pointer, :int, :pointer, :int ], :void
|
||||||
attach_function :fdb_transaction_clear, [ :pointer, :pointer, :int ], :void
|
attach_function :fdb_transaction_clear, [ :pointer, :pointer, :int ], :void
|
||||||
attach_function :fdb_transaction_clear_range, [ :pointer, :pointer, :int, :pointer, :int ], :void
|
attach_function :fdb_transaction_clear_range, [ :pointer, :pointer, :int, :pointer, :int ], :void
|
||||||
@ -819,10 +819,10 @@ module FDB
|
|||||||
get_range(prefix, FDB.strinc(prefix), options, &block)
|
get_range(prefix, FDB.strinc(prefix), options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_storage_byte_sample(beginKey, endKey)
|
def get_estimated_range_size_bytes(beginKey, endKey)
|
||||||
bkey = FDB.key_to_bytes(beginKey)
|
bkey = FDB.key_to_bytes(beginKey)
|
||||||
ekey = FDB.key_to_bytes(endKey)
|
ekey = FDB.key_to_bytes(endKey)
|
||||||
Int64Future.new(FDBC.fdb_transaction_get_storage_byte_sample(@tpointer, bkey, bkey.bytesize, ekey, ekey.bytesize))
|
Int64Future.new(FDBC.fdb_transaction_get_estimated_range_size_bytes(@tpointer, bkey, bkey.bytesize, ekey, ekey.bytesize))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
virtual ThreadFuture<Standalone<StringRef>> getVersionstamp() = 0;
|
virtual ThreadFuture<Standalone<StringRef>> getVersionstamp() = 0;
|
||||||
|
|
||||||
virtual void addReadConflictRange(const KeyRangeRef& keys) = 0;
|
virtual void addReadConflictRange(const KeyRangeRef& keys) = 0;
|
||||||
virtual ThreadFuture<int64_t> getStorageByteSample(const KeyRangeRef& keys) = 0;
|
virtual ThreadFuture<int64_t> getEstimatedRangeSizeBytes(const KeyRangeRef& keys) = 0;
|
||||||
|
|
||||||
virtual void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) = 0;
|
virtual void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) = 0;
|
||||||
virtual void set(const KeyRef& key, const ValueRef& value) = 0;
|
virtual void set(const KeyRef& key, const ValueRef& value) = 0;
|
||||||
|
@ -145,11 +145,11 @@ ThreadFuture<Standalone<StringRef>> DLTransaction::getVersionstamp() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadFuture<int64_t> DLTransaction::getStorageByteSample(const KeyRangeRef& keys) {
|
ThreadFuture<int64_t> DLTransaction::getEstimatedRangeSizeBytes(const KeyRangeRef& keys) {
|
||||||
if (!api->transactionGetStorageByteSample) {
|
if (!api->transactionGetEstimatedRangeSizeBytes) {
|
||||||
return unsupported_operation();
|
return unsupported_operation();
|
||||||
}
|
}
|
||||||
FdbCApi::FDBFuture *f = api->transactionGetStorageByteSample(tr, keys.begin.begin(), keys.begin.size(), keys.end.begin(), keys.end.size());
|
FdbCApi::FDBFuture *f = api->transactionGetEstimatedRangeSizeBytes(tr, keys.begin.begin(), keys.begin.size(), keys.end.begin(), keys.end.size());
|
||||||
|
|
||||||
return toThreadFuture<int64_t>(api, f, [](FdbCApi::FDBFuture *f, FdbCApi *api) {
|
return toThreadFuture<int64_t>(api, f, [](FdbCApi::FDBFuture *f, FdbCApi *api) {
|
||||||
int64_t sampledSize;
|
int64_t sampledSize;
|
||||||
@ -321,7 +321,7 @@ void DLApi::init() {
|
|||||||
loadClientFunction(&api->transactionReset, lib, fdbCPath, "fdb_transaction_reset");
|
loadClientFunction(&api->transactionReset, lib, fdbCPath, "fdb_transaction_reset");
|
||||||
loadClientFunction(&api->transactionCancel, lib, fdbCPath, "fdb_transaction_cancel");
|
loadClientFunction(&api->transactionCancel, lib, fdbCPath, "fdb_transaction_cancel");
|
||||||
loadClientFunction(&api->transactionAddConflictRange, lib, fdbCPath, "fdb_transaction_add_conflict_range");
|
loadClientFunction(&api->transactionAddConflictRange, lib, fdbCPath, "fdb_transaction_add_conflict_range");
|
||||||
loadClientFunction(&api->transactionGetStorageByteSample, lib, fdbCPath, "fdb_transaction_get_storage_byte_sample", headerVersion >= 700);
|
loadClientFunction(&api->transactionGetEstimatedRangeSizeBytes, lib, fdbCPath, "fdb_transaction_get_estimated_range_size_bytes", headerVersion >= 700);
|
||||||
|
|
||||||
loadClientFunction(&api->futureGetInt64, lib, fdbCPath, headerVersion >= 620 ? "fdb_future_get_int64" : "fdb_future_get_version");
|
loadClientFunction(&api->futureGetInt64, lib, fdbCPath, headerVersion >= 620 ? "fdb_future_get_int64" : "fdb_future_get_version");
|
||||||
loadClientFunction(&api->futureGetError, lib, fdbCPath, "fdb_future_get_error");
|
loadClientFunction(&api->futureGetError, lib, fdbCPath, "fdb_future_get_error");
|
||||||
@ -562,9 +562,9 @@ void MultiVersionTransaction::addReadConflictRange(const KeyRangeRef& keys) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadFuture<int64_t> MultiVersionTransaction::getStorageByteSample(const KeyRangeRef& keys) {
|
ThreadFuture<int64_t> MultiVersionTransaction::getEstimatedRangeSizeBytes(const KeyRangeRef& keys) {
|
||||||
auto tr = getTransaction();
|
auto tr = getTransaction();
|
||||||
auto f = tr.transaction ? tr.transaction->getStorageByteSample(keys) : ThreadFuture<int64_t>(Never());
|
auto f = tr.transaction ? tr.transaction->getEstimatedRangeSizeBytes(keys) : ThreadFuture<int64_t>(Never());
|
||||||
return abortableFuture(f, tr.onChange);
|
return abortableFuture(f, tr.onChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ struct FdbCApi : public ThreadSafeReferenceCounted<FdbCApi> {
|
|||||||
void (*transactionClearRange)(FDBTransaction *tr, uint8_t const *beginKeyName, int beginKeyNameLength, uint8_t const *endKeyName, int endKeyNameLength);
|
void (*transactionClearRange)(FDBTransaction *tr, uint8_t const *beginKeyName, int beginKeyNameLength, uint8_t const *endKeyName, int endKeyNameLength);
|
||||||
void (*transactionAtomicOp)(FDBTransaction *tr, uint8_t const *keyName, int keyNameLength, uint8_t const *param, int paramLength, FDBMutationTypes::Option operationType);
|
void (*transactionAtomicOp)(FDBTransaction *tr, uint8_t const *keyName, int keyNameLength, uint8_t const *param, int paramLength, FDBMutationTypes::Option operationType);
|
||||||
|
|
||||||
FDBFuture* (*transactionGetStorageByteSample)(FDBTransaction* tr, uint8_t const* begin_key_name,
|
FDBFuture* (*transactionGetEstimatedRangeSizeBytes)(FDBTransaction* tr, uint8_t const* begin_key_name,
|
||||||
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length);
|
int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length);
|
||||||
|
|
||||||
FDBFuture* (*transactionCommit)(FDBTransaction *tr);
|
FDBFuture* (*transactionCommit)(FDBTransaction *tr);
|
||||||
@ -132,7 +132,7 @@ public:
|
|||||||
ThreadFuture<Standalone<RangeResultRef>> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override;
|
ThreadFuture<Standalone<RangeResultRef>> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override;
|
||||||
ThreadFuture<Standalone<VectorRef<const char*>>> getAddressesForKey(const KeyRef& key) override;
|
ThreadFuture<Standalone<VectorRef<const char*>>> getAddressesForKey(const KeyRef& key) override;
|
||||||
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
||||||
ThreadFuture<int64_t> getStorageByteSample(const KeyRangeRef& keys) override;
|
ThreadFuture<int64_t> getEstimatedRangeSizeBytes(const KeyRangeRef& keys) override;
|
||||||
|
|
||||||
void addReadConflictRange(const KeyRangeRef& keys) override;
|
void addReadConflictRange(const KeyRangeRef& keys) override;
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ public:
|
|||||||
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
||||||
|
|
||||||
void addReadConflictRange(const KeyRangeRef& keys) override;
|
void addReadConflictRange(const KeyRangeRef& keys) override;
|
||||||
ThreadFuture<int64_t> getStorageByteSample(const KeyRangeRef& keys) override;
|
ThreadFuture<int64_t> getEstimatedRangeSizeBytes(const KeyRangeRef& keys) override;
|
||||||
|
|
||||||
void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) override;
|
void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) override;
|
||||||
void set(const KeyRef& key, const ValueRef& value) override;
|
void set(const KeyRef& key, const ValueRef& value) override;
|
||||||
|
@ -1343,7 +1343,7 @@ Future< Standalone<VectorRef<const char*> >> ReadYourWritesTransaction::getAddre
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int64_t> ReadYourWritesTransaction::getStorageByteSample(const KeyRangeRef& keys) {
|
Future<int64_t> ReadYourWritesTransaction::getEstimatedRangeSizeBytes(const KeyRangeRef& keys) {
|
||||||
if(checkUsedDuringCommit()) {
|
if(checkUsedDuringCommit()) {
|
||||||
throw used_during_commit();
|
throw used_during_commit();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Future<Standalone<VectorRef<const char*>>> getAddressesForKey(const Key& key);
|
[[nodiscard]] Future<Standalone<VectorRef<const char*>>> getAddressesForKey(const Key& key);
|
||||||
Future<int64_t> getStorageByteSample( const KeyRangeRef& keys );
|
Future<int64_t> getEstimatedRangeSizeBytes( const KeyRangeRef& keys );
|
||||||
|
|
||||||
void addReadConflictRange( KeyRangeRef const& keys );
|
void addReadConflictRange( KeyRangeRef const& keys );
|
||||||
void makeSelfConflicting() { tr.makeSelfConflicting(); }
|
void makeSelfConflicting() { tr.makeSelfConflicting(); }
|
||||||
|
@ -157,12 +157,12 @@ ThreadFuture< Key > ThreadSafeTransaction::getKey( const KeySelectorRef& key, bo
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadFuture<int64_t> ThreadSafeTransaction::getStorageByteSample( const KeyRangeRef& keys ) {
|
ThreadFuture<int64_t> ThreadSafeTransaction::getEstimatedRangeSizeBytes( const KeyRangeRef& keys ) {
|
||||||
KeyRange r = keys;
|
KeyRange r = keys;
|
||||||
|
|
||||||
ReadYourWritesTransaction *tr = this->tr;
|
ReadYourWritesTransaction *tr = this->tr;
|
||||||
return onMainThread( [tr, r]() -> Future<int64_t> {
|
return onMainThread( [tr, r]() -> Future<int64_t> {
|
||||||
return tr->getStorageByteSample(r);
|
return tr->getEstimatedRangeSizeBytes(r);
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
}
|
}
|
||||||
ThreadFuture<Standalone<VectorRef<const char*>>> getAddressesForKey(const KeyRef& key) override;
|
ThreadFuture<Standalone<VectorRef<const char*>>> getAddressesForKey(const KeyRef& key) override;
|
||||||
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
ThreadFuture<Standalone<StringRef>> getVersionstamp() override;
|
||||||
ThreadFuture<int64_t> getStorageByteSample(const KeyRangeRef& keys) override;
|
ThreadFuture<int64_t> getEstimatedRangeSizeBytes(const KeyRangeRef& keys) override;
|
||||||
|
|
||||||
void addReadConflictRange( const KeyRangeRef& keys ) override;
|
void addReadConflictRange( const KeyRangeRef& keys ) override;
|
||||||
void makeSelfConflicting();
|
void makeSelfConflicting();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user