Version the behavior change of existing API so that new behavior only happen after 7.0

This commit is contained in:
Xin Dong 2020-09-16 09:43:57 -07:00
parent acdf04ed18
commit e108f041a0
2 changed files with 8 additions and 2 deletions

View File

@ -463,7 +463,13 @@ class TransactionRead(_FDBBase):
def get_estimated_range_size_bytes(self, begin_key, end_key):
if begin_key is None or end_key is None:
raise Exception('Invalid begin key or end key')
if fdb.get_api_version() >= 700:
raise Exception('Invalid begin key or end key')
else:
if begin_key is None:
begin_key = b''
if end_key is None:
end_key = b'\xff'
return FutureInt64(self.capi.fdb_transaction_get_estimated_range_size_bytes(
self.tpointer,
begin_key, len(begin_key),

View File

@ -843,7 +843,7 @@ module FDB
end
def get_estimated_range_size_bytes(begin_key, end_key)
if begin_key.nil? || end_key.nil?
if FDB.get_api_version()>= 700 && (begin_key.nil? || end_key.nil?)
raise ArgumentError, "Invalid begin key or end key"
end
bkey = FDB.key_to_bytes(begin_key)