mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Address more review comments
This commit is contained in:
parent
0a7d2d31f1
commit
0282a1745a
@ -3,4 +3,4 @@ module github.com/apple/foundationdb/bindings/go
|
||||
// The FoundationDB go bindings currently have no external golang dependencies outside of
|
||||
// the go standard library.
|
||||
|
||||
require golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543// indirect
|
||||
require golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
|
||||
|
@ -462,10 +462,8 @@ class TransactionRead(_FDBBase):
|
||||
return self.get(key)
|
||||
|
||||
def get_estimated_range_size_bytes(self, begin_key, end_key):
|
||||
if begin_key is None:
|
||||
begin_key = b''
|
||||
if end_key is None:
|
||||
end_key = b'\xff'
|
||||
if begin_key is None or end_key is None:
|
||||
raise Exception('Invalid begin key or end key')
|
||||
return FutureInt64(self.capi.fdb_transaction_get_estimated_range_size_bytes(
|
||||
self.tpointer,
|
||||
begin_key, len(begin_key),
|
||||
@ -751,7 +749,7 @@ class FutureKeyArray(Future):
|
||||
ks = ctypes.pointer(KeyStruct())
|
||||
count = ctypes.c_int()
|
||||
self.capi.fdb_future_get_key_array(self.fpointer, ctypes.byref(ks), ctypes.byref(count))
|
||||
return ([ctypes.string_at(x.key, x.key_length) for x in ks[0:count.value]], count.value)
|
||||
return [ctypes.string_at(x.key, x.key_length) for x in ks[0:count.value]]
|
||||
|
||||
|
||||
class FutureStringArray(Future):
|
||||
|
@ -488,10 +488,10 @@ module FDB
|
||||
FDBC.check_error FDBC.fdb_future_get_key_array(@fpointer, kvs, count)
|
||||
ks = ks.read_pointer
|
||||
|
||||
[(0..count.read_int-1).map{|i|
|
||||
(0..count.read_int-1).map{|i|
|
||||
x = FDBC::KeyStruct.new(ks + (i * FDBC::KeyStruct.size))
|
||||
x[:key].read_bytes(x[:key_length])
|
||||
}, count.read_int]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -340,7 +340,7 @@ void DLApi::init() {
|
||||
loadClientFunction(&api->transactionAddConflictRange, lib, fdbCPath, "fdb_transaction_add_conflict_range");
|
||||
loadClientFunction(&api->transactionGetEstimatedRangeSizeBytes, lib, fdbCPath, "fdb_transaction_get_estimated_range_size_bytes", headerVersion >= 630);
|
||||
loadClientFunction(&api->transactionGetRangeSplitPoints, lib, fdbCPath, "fdb_transaction_get_range_split_points",
|
||||
headerVersion >= 630);
|
||||
headerVersion >= 700);
|
||||
|
||||
loadClientFunction(&api->futureGetInt64, lib, fdbCPath, headerVersion >= 620 ? "fdb_future_get_int64" : "fdb_future_get_version");
|
||||
loadClientFunction(&api->futureGetError, lib, fdbCPath, "fdb_future_get_error");
|
||||
|
Loading…
x
Reference in New Issue
Block a user