mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-24 16:20:15 +08:00
Python and Ruby bindings displayed an unhelpful error if trying to load an old incompatible fdb_c with a new binding.
This commit is contained in:
parent
627b785a24
commit
401f8a6774
bindings
@ -81,6 +81,8 @@ def api_version(ver):
|
||||
elif err != 0:
|
||||
raise RuntimeError('FoundationDB API error')
|
||||
|
||||
fdb.impl.init_c_api()
|
||||
|
||||
list = (
|
||||
'FDBError',
|
||||
'predicates',
|
||||
|
@ -1285,6 +1285,7 @@ def optionalParamToBytes(v):
|
||||
|
||||
_FDBBase.capi = _capi
|
||||
|
||||
def init_c_api():
|
||||
_capi.fdb_select_api_version_impl.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||
_capi.fdb_select_api_version_impl.restype = ctypes.c_int
|
||||
|
||||
|
@ -70,6 +70,8 @@ module FDB
|
||||
raise "FoundationDB API version error"
|
||||
end
|
||||
|
||||
FDBC.init_c_api()
|
||||
|
||||
require_relative 'fdbtuple'
|
||||
require_relative 'fdbdirectory'
|
||||
|
||||
|
@ -64,6 +64,10 @@ module FDB
|
||||
typedef :int, :fdb_error
|
||||
typedef :int, :fdb_bool
|
||||
|
||||
attach_function :fdb_select_api_version_impl, [ :int, :int ], :fdb_error
|
||||
attach_function :fdb_get_max_api_version, [ ], :int
|
||||
|
||||
def self.init_c_api
|
||||
attach_function :fdb_get_error, [ :fdb_error ], :string
|
||||
|
||||
attach_function :fdb_network_set_option, [ :int, :pointer, :int ], :fdb_error
|
||||
@ -113,9 +117,7 @@ module FDB
|
||||
attach_function :fdb_transaction_get_versionstamp, [ :pointer ], :pointer
|
||||
attach_function :fdb_transaction_on_error, [ :pointer, :fdb_error ], :pointer
|
||||
attach_function :fdb_transaction_reset, [ :pointer ], :void
|
||||
|
||||
attach_function :fdb_select_api_version_impl, [ :int, :int ], :fdb_error
|
||||
attach_function :fdb_get_max_api_version, [ ], :int
|
||||
end
|
||||
|
||||
class KeyValueStruct < FFI::Struct
|
||||
pack 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user